javascript - How do I parse a piece of text from a previously-clicked link or page name? -
i'm working on online art auction. bid updates manual. when person clicks "bid now!" via button below piece, simple form pops in new window. form on page little bit of information, including title of piece bid on (the title becomes subject of email receive form). question is, can parse title of piece onto pop-up form page previous page using javascript or jquery? script have piece of text previous page somehow. i'm envisioning this:
<a href="../bid-form.html" name="lastname" value="titleofwork"><img src="image.html"/></a> the pop-up form page (shown in fiddle) "titleofwork" , place in first line of text. (but value change, i'd need call variable).
my other alternative (how the previous programmer set things up) make form page every piece of work, because titles different. don't want because it's impractical. there hundreds of works in auction.
i feel simpler solution i'm making out be... i'm self-taught , don't know many of basics. hope makes sense!
*edit:
this javascript i'm trying work (i'll include directly on bid-form page, need "value" variable (aka, "value" defined in link opened form, title of work):
<script> // check browser support if (typeof(storage) != "undefined") { // store localstorage.setitem("lastname", "[variable]"); // retrieve document.getelementbyid("title").innerhtml=localstorage.getitem("lastname"); } else { document.getelementbyid("title").innerhtml="sorry, browser not support web storage..."; } </script> here's updated link fiddle. http://jsfiddle.net/uvkvt/2/
my suggestion need use localstorage instead.
add html id , value code
<a href="../image.html" name="#titleofwork" id="titleofwork" value="yourvalue">bid now!</a> in javascript file, need grab value id, save , retrieve using localstorage.
save
localstorage.header = $("$titleofwork").val(); retrieve
$("#header").settext(localstorage.header); your popup html code
<h1 id="header"></h1> p.s: need use jquery
Comments
Post a Comment