garry27 Posted February 4, 2007 Share Posted February 4, 2007 document.getElementById("pp-div2").innerHTML = " <a class='center-all' href='javascript:addPubFn(" +pubID+','+pubName+','+ pubPostcode+ ")'>Add to Pub Crawl</a>"; Quote Link to comment Share on other sites More sharing options...
garry27 Posted February 4, 2007 Author Share Posted February 4, 2007 javascript sucks! Quote Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 Your quoting is inconsistent. Quote Link to comment Share on other sites More sharing options...
garry27 Posted February 5, 2007 Author Share Posted February 5, 2007 the following code works when i pass integer variables but not strings. document.getElementById("pp-div2").innerHTML = "<a href='#' onClick='addPubFn(" + var1+ "," + var2+ "," + var3+ "); return false;'>Add to Pub Crawl</a>"; changeBodyClass("pp-div2-hide","pp-div2-show"); i just get the same error. you can see this for yourself by clicking on a marker and then the add pub link in the panel here: http://www.nl-webspace.co.uk/~unn_p921847/s2/create_crawl.php?call=2&postcode=dl3+7&lat=54.524800208734&lng=-1.5606556890128# very odd Quote Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 No, not strange at all... you're not quoting your JS parameters. Quote Link to comment Share on other sites More sharing options...
garry27 Posted February 5, 2007 Author Share Posted February 5, 2007 ye, but when i do it still doesn't work Quote Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 It should be "<a href='#' onClick='addPubFn("' + var1+ "','" + var2+ "','" + var3+ "'); return false;'>Add to Pub Crawl</a>"; changeBodyClass("pp-div2-hide","pp-div2-show"); Quote Link to comment Share on other sites More sharing options...
garry27 Posted February 5, 2007 Author Share Posted February 5, 2007 that doesn't work either. i get 'missing ; before statement' Quote Link to comment Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 Sorry, my bad... the quoting is horrible. "<a href='#' onClick='addPubFn(\"" + var1+ "\",\"" + var2+ "\",\"" + var3+ "\"); return false;'>Add to Pub Crawl</a>"; changeBodyClass("pp-div2-hide","pp-div2-show"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.