JavaScript - Posting Info From Javascript Api
Hi everyone!
Firstly, im a beginner in Javascript, totally noobie. Much why this is posted! I have found this site: http://www.forswor.com/index.php/data-apis/ And I want to use this to post the server status on my forum/website. How exactly do I do that? I know there are examples and such and I have read and read on that page but I cannot figure out how to do this. I cant just paste: <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php"> </script> How would I get this to show the information of say for example Bloodworthy server and in text? I tried adding the line document.write(forswor_server_name);, but didnt show up anything - stupid as I am obviously I have no clue what im doing. I can manage html\css and some php but this is new for me, hehe. Thank you so much for reading an idiots post! Most regards, me. Similar TutorialsHello All, Forgive me if my terminology is off, as I am a Java and PHP newbie, but i will do my best to explain my problems. I am building a simple site for my job and the HTML and CSS is done. I used a simple PHP script to post form data to an SQL table. I wanted to first create a client side form validator to ensure proper data was being entered into the form (First name, last name, phone, email, state, zip code). Data was being posted to the form no problem prior to the Javascript validation. Now that the Javascript validation is in place, no data is passed to the database and only empty records appear in the table when the form is submitted. How do I get Javascript and PHP to play nicely together? I still need to create a server side validation and also a sanitation script to make sure no one tries to inject malicious code, but my main focus now is making sure data can get posted to the database. Please help me out, and correct any incorrect terminology I'm using. This is my form: Code: <form name="form1" id="form1" "method="post" action="insert.php"> <table width="80%" border="0"> <tr> <td align="right">First Name : </td> <td><input type="text" name="fname" style="width:170px;"></td> </tr> <tr> <td align="right">Last Name : </td> <td><input type="text" name="lname" style="width:170px;"></td> </tr> <tr> <td align="right">Phone : </td> <td class=><input type="text" name="phone" style="width:100px;"> </td> </tr> <tr> <td align="right">Email : </td> <td> <input type="text" name="email" style="width:170px;"></td> </tr> <tr> <td align="right">State : </td> <td><select name="state" style="width:150px;"> <option value="000" selected="selected">Select</option> <option value="Alabama">Alabama</option> <option value="Alaska" >Alaska</option> <option value="Arizona" >Arizona</option> <option value="Arkansas" >Arkansas</option> <option value="California" >California</option> <option value="Colorado" >Colorado</option> <option value="Connecticut" >Connecticut</option> <option value="Delaware" >Delaware</option> <option value="District-of-Columbia" >District of Columbia</option> <option value="Florida">Florida</option> <option value="Georgia" >Georgia</option> <option value="Hawaii" >Hawaii</option> <option value="Idaho" >Idaho</option> <option value="Illinois" >Illinois</option> <option value="Indiana" >Indiana</option> <option value="Iowa" >Iowa</option> <option value="Kansas" >Kansas</option> <option value="Kentucky" >Kentucky</option> <option value="Louisiana" >Louisiana</option> <option value="Maine" >Maine</option> <option value="Maryland" >Maryland</option> <option value="Massachusetts" >Massachusetts</option> <option value="Michigan" >Michigan</option> <option value="Minnesota" >Minnesota</option> <option value="Mississippi" >Mississippi</option> <option value="Missouri" >Missouri</option> <option value="Montana" >Montana</option> <option value="Nebraska" >Nebraska</option> <option value="Nevada" >Nevada</option> <option value="New-Hampshire" >New Hampshire</option> <option value="New-Jersey" >New Jersey</option> <option value="New-Mexico" >New Mexico</option> <option value="New-York" >New York</option> <option value="North-Carolina" >North Carolina</option> <option value="North-Dakota" >North Dakota</option> <option value="Ohio" >Ohio</option> <option value="Oklahoma" >Oklahoma</option> <option value="Oregon" >Oregon</option> <option value="Pennsylvania" >Pennsylvania</option> <option value="Rhode-Island" >Rhode Island</option> <option value="South-Carolina" >South Carolina</option> <option value="South-Dakota" >South Dakota</option> <option value="Tennessee" >Tennessee</option> <option value="Texas" >Texas</option> <option value="Utah" >Utah</option> <option value="Vermont" >Vermont</option> <option value="Virginia" >Virginia</option> <option value="Washington" >Washington</option> <option value="West-Virginia" >West Virginia</option> <option value="Wisconsin" >Wisconsin</option> <option value="Wyoming" >Wyoming</option> </select> </td> </tr><tr> <td align="right">Zip Code: </td> <td><input type="text" name="zcode" style="width:50px;"></td> </tr> <tr> <td> </td> <input type="hidden" name="submitted" value="1"> <td><input type="submit" value="Submit" name="submit"></td> </tr> </table> </form> This is my javascript code that links to an external .js file: Code: <script type="text/javascript"> var frmvalidator = new Validator("form1"); frmvalidator.addValidation("fname","req","Please enter your First Name"); frmvalidator.addValidation("fname","minlen=2","Minimum length for First Name is 2 characters"); frmvalidator.addValidation("fname","maxlen=20","Max length for First Name is 20 characters"); frmvalidator.addValidation("lname","req","Please enter your Last Name"); frmvalidator.addValidation("lname","minlen=2","Minimum length for Last Name is 2 characters"); frmvalidator.addValidation("lname","maxlen=20","Max length for Last Name is 20 characters"); frmvalidator.addValidation("email","req","Please enter a Valid Email Address"); frmvalidator.addValidation("email","maxlen=50"); frmvalidator.addValidation("phone","req","Please enter your 10-digit Phone Number. Example: 5051234567"); frmvalidator.addValidation("phone","minlen=10","Please enter your 10-digit Phone Number. Example: 5051234567"); frmvalidator.addValidation("phone","maxlen=10","Please enter your 10-digit Phone Number. Example: 5051234567"); frmvalidator.addValidation("phone","numeric"); frmvalidator.addValidation("state","dontselect=000","Please select your state"); frmvalidator.addValidation("zcode","req","Please enter your 5-digit Zip Code"); frmvalidator.addValidation("zcode","minlen=5","Please enter your 5-digit Zip Code"); frmvalidator.addValidation("zcode","maxlen=5","Please enter your 5-digit Zip Code"); </script> This is my insert.php file that form uses: PHP Code: <?php $con = mysql_connect("localhost","**********","**********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sms2011_leads", $con); $sql="INSERT INTO sms2011_prospects (fname, lname, phone, email, state, zcode) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[phone]','$_POST[email]','$_POST[state]','$_POST[zcode]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "<script>window.location = 'http://www.nationalcollegesearch.org/thankyou.html';</script>"; mysql_close($con) ?> Hello, Below I have my Small form: Code: <p id="join_our_mailing_list">Join our mailing list</p> <form method="post" name="join" action="#" /> <input type="text" class="input_text" name="join_us_email" id="join_us_email" /> <input type="submit" value="submit" class="button join_us_button" /> </form> Then I have my JS to process this... Code: $(".join_us_button").click(function() { var email = $("#join_us_email").val(); var dataString = 'join_us_email='+ email; if(email=='') { $('p#join_our_mailing_list').replaceWith("<p>Provide email</p>"); } else { $.ajax({ type: "POST", url: "join.php", data: dataString, success: function() { $('p#join_our_mailing_list').replaceWith("<p>Thank you</p>"); } }); } return false; }); }); How and what can I do to allow this form to insert into SQL Database? I'd like to insert into SQL their emailaddress, IP, date and referral page.... Thanks for anyone that can help! Hi all, I've written the following script: Code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Keys2</title> <script type="text/javascript"> function keyPress(key){ document.getElementById('rect01').style.fill = "red"; } </script> <style> .button { width: 100px; padding-right:10px; height:2em; background-color:#FC3; border-radius:3px; color:#fff; font-weight:bold; } ul { list-style-type: none; padding: 0; margin-left:25px; } li { float:left; width:30px; margin-right:25px; padding:10px; height:2em; background-color:#FC3; font-size:xx-large; } </style> </head> <body> <div> <svg width="1000" height="200"> <rect x="25" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect01"/> <rect x="100" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect02"/> <rect x="175" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect03"/> <rect x="250" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect04"/> <rect x="325" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect05"/> <rect x="400" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect06"/> <rect x="475" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect07"/> <rect x="550" y="50" fill="#FFFFFF" stroke="#000000" width="50" height="150" id="rect08"/> </svg> </div> <div> <ul> <li><a href="#" class="button" onClick="keyPress(rect01);">A</a></li> <li><a href="#" class="button" onClick="keyPress(rect02);">B</a></li> <li><a href="#" class="button" onClick="keyPress(rect03);">C</a></li> <li><a href="#" class="button" onClick="keyPress(rect04);">D</a></li> <li><a href="#" class="button" onClick="keyPress(rect05);">E</a></li> <li><a href="#" class="button" onClick="keyPress(rect06);">F</a></li> <li><a href="#" class="button" onClick="keyPress(rect07);">G</a></li> <li><a href="#" class="button" onClick="keyPress(rect08);">H</a></li> </ul> </div> </body> </html> Now, I could write a version of the keypress function for each rectangle, but that seems like poor coding. Can anyone point out how I might restructure the function or the code so that I can pass the number in the onClick to the rectangle it refers to? Thanks Hello guys, Is there any way I can get the number of 'CPBucks' from this piece of HTML, It's currently at 1 but it will change. Code: <div class="user-info"> <img src="http://illiweb.com/fa/punbb/online.png" id="i_icon_online" alt="Online" title="Online"><br> <span style="white-space:nowrap;"><span style="color:##66666;">Posts</span>: </span>2<br> <span style="white-space:nowrap;"><span style="color:##66666;">CPBucks</span>: </span>1<br> <span style="white-space:nowrap;"><span style="color:##66666;">Join date</span>: </span>2011-10-11<br> </div> Thanks Hi, I currently have a asp.NET page which has a textbox with the ID: "txtbox1" I would like javascript to store the data entered into txtbox1 into a var. I have tried using var jVarName; jVarName = '<%#aVarName%>'; but so far it hasnt worked. Any suggestions would be appreciated ^^ I have used the PHP Calculator thanks to "ralph l mayo" and it is exactly what I'm in need of BUT the problem is now when I put it into my html doc in Dreamweaver CS4 and preview in IE everything below the calculation is gone / blank / disappeared. What is the story...PLEASE PLEASE HELP
Hi all, I want to display varying company information from a javascript array randomly each time the page is refreshed. My problem is that the each piece of company information must be split up into 3-4 array elements since I have set up spans in the body where the information go accordingly and as such I don't how to randomize that. The relevant code is (I will only give two company examples as it's a long list): Code: <script type="text/javascript" language='javascript'> function compInfo(comp){ var companyInfo = new Array(); if(comp == document.getElementById('test').innerHTML) { //insert business name here. companyInfo[0] = 'Test'; //insert business type here. companyInfo[1] = 'Media'; //insert street name here. companyInfo[2] = 'Test Road.'; //insert actual opening time here. companyInfo[3] = '5am - 10pm'; //insert actual closing time here. companyInfo[4] = 'Christmas'; //insert contact info here. companyInfo[5] = 'test'; //insert web address here. companyInfo[6] = '<a href="http://www.test.com" style="color: #0092DD; text-decoration: none;">test.com</a>'; //insert image link here. companyInfo[7] = 'images/test.jpg'; } if(comp == document.getElementById('test1').innerHTML) { //insert business name here. companyInfo [0] = 'Test1'; //insert business type here. companyInfo [1] = 'Club'; //insert street name here. companyInfo[2] = 'Test1 Road.'; //insert actual opening time here. companyInfo[3] = '5am - 10pm'; //insert actual closing time here. companyInfo[4] = 'Christmas'; //insert contact info here. companyInfo[5] = 'test1'; //insert web address here. companyInfo[6] = '<a href="http://www.test1.com" style="color: #0092DD; text-decoration: none;">test1.com</a>'; //insert image link here. companyInfo[7] = 'images/test1.jpg'; } document.getElementById('title').innerHTML =companyInfo[0]; document.getElementById('name').innerHTML = companyInfo[1]; document.getElementById('street').innerHTML = companyInfo[2]; document.getElementById('open').innerHTML = 'Open'; document.getElementById('otime').innerHTML = companyInfo[3]; document.getElementById('close').innerHTML = 'Closed' document.getElementById('ctime').innerHTML = companyInfo[4]; document.getElementById('contact').innerHTML = 'Contact'; document.getElementById('cinfo').innerHTML = companyInfo[5]; document.getElementById('web').innerHTML = companyInfo[6]; document.getElementById('image').style.display = 'block'; document.getElementById('image').src = companyInfo[7]; } </script> </head> <body> <SPAN ID='test' onclick="compInfo(document.getElementById('test').innerHTML);"><b>Test</b></SPAN> <SPAN ID='test1' onclick="compInfo(document.getElementById('test1').innerHTML);"><b>Test1</b></SPAN> //info shown he <div style='text-overflow: ellipsis;'> <table cellpadding='0' cellspacing='0' border='0' style='height:178px; width:185px;'> <tr> <td align="left" style='height:25px;'> <b><SPAN ID='title' ></SPAN></b> </td> </tr> <tr> <td align="left" > <SPAN ID='name' ></SPAN> <br /> <SPAN ID='street'></SPAN> <div style='height:8px;'> </div> <SPAN ID='open'></SPAN> <br /> <SPAN ID='otime'></SPAN> <br /> <SPAN ID='close'></SPAN> <br /> <SPAN ID='ctime'></SPAN> <br /> <div style='height:8px;'> </div> <SPAN ID='contact'></SPAN> <br /> <SPAN ID='cinfo'></SPAN> <SPAN ID='web'></SPAN> <img ID='image' style='display:none;'></img> </td> </tr> </table> </div> </body> So essentially the process is: 1. The person clicks on the company name. 2. Relevant information from the array is shown in the div. But what I want is that on startup, information about a random company is shown automatically. How can I achieve this? Thanks. Hi, Im new to javascript so thankyou in advance for reading this! Im trying to create a video gallery, with thumbnails below a main content div, which when clicked display the relevant video in the said div. This isn't a problem and I have managed to do this... However, I also need to display descriptive text (different for every video) in a seperate div, and the first video also needs to autoplay when the page is loaded (rather than waiting until the user requests a video by clicking a thumbnail) I've made an example of where Im at so far and its viewable here... http://www.phixfilm.com/video_thumbn...ideo_test.html The div 'a few lines of info about vid here' is currently just static but this is what i need to change each time a different video is requested by the user (sorry if thats obvious but just in case its not clear) I will be using .movs but I've embedded youtube for now although I don't think that makes any difference... Im presuming it will be a case of having text that is hidden until the thumbnail is clicked...? Which I guess I could do with css but that way seems a little clumsy, I really am a newbie to javascript so a helping hand in the right direction would be very much appreciated. THANKYOU! ps- an example of something similar to what Im trying to achieve is here... http://somesuchandco.com/#670098/Nathalie-Canguilhem Below is the code. My function: Code: function swap_content(id1,id2) { var tmp = document.getElementById(id1).name; var theval = document.getElementsByName('primary_propertyp_id')[0].value; document.getElementById(id1).name = document.getElementsByName('primary_propertyp_id')[0].name; document.getElementsByName('primary_propertyp_id')[0].name = tmp; document.getElementById(id2).id = document.getElementById('primary').id; document.getElementById('primary').id = 'addressid_'+theval+'_div'; } Applicable Code for primary info: Code: <div id="primary"> <label>primary to secondary:</label><input name="primary_propertyp_id" type="text" id="addressid_<? echo $row['primary_property_id']; ?>" value="<? echo $row['primary_property_id']; ?>"/> </div> Applicable Code for secondary info/link to change: Code: echo "<div id=\"addressid_" . $properties_row['id'] . "_div\">"; echo "<a href=\"#\" onclick=\"swap_content('addressid_" . $properties_row['id'] . "','addressid_" . $properties_row['id'] . "_div'); return false\">Make Primary</a>"; echo "<input id=\"addressid_" . $properties_row['id'] . "\" name=\"addressids[]\" value=\"" . $properties_row['id'] . "\" type=\"text\">"; echo "</div>"; This is running through a PHP loop so it's making multiple divs and links for the secondaries. I am wanting to be able to swap out any of them to make them 'primary'....this works for the first click, but after the first click it makes every div id and input name the same as the first that was clicked. It's also not working AT all if i click on the bottom link first, then a link above it. Top-down works, bottom-up doesn't...Please help Thanks in advance, Jeremy Hello all I have written a web page to create XML from user input. The user inputs a series of values, and these are turned into XML using javascript. The way I have done this is to load in a template XML file using an XMLHTTPrequest and append childNodes to it as required. Thus, what I end up with is a variable called "xmldoc" which is an XML document object. (If I do write(xmldoc) the answer I get is [object XMLDocument].) What I would like to do is to be able to save the thing as an xml file. To this end I have been trying to POST it to a php file that might do this, but to no avail; the php file does not seem to recognise it as an XML DOM object. I just can't work out how I might do this, and all suggestions would be gratefully received. Cheers, Chris Hi, I need to provide the ability for a user to login and make a posting for announcements. I have done some searching and haven't really came up with anything that will work. I am using a script that is external to the web page that will display the message. My idea was to create a Div that contains a multi-line text box within it. I thought it might be possible to use innerHTML to post a message from a form to the web page that has this text box. Is this a good approach or is there a better way? I'm not really asking anyone to code this for me but some suggestions for achieving this task would be greatly appreciated. I am trying to move away from using a CMS for this particular site. Thanks for your help! Rob Hi Guys. Trying to pass variables from the javascript into my php script and into my SQL query so i can track the location of the iphone. So far i have... Code: <script type="text/javascript"> function getGPS() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showGPS, gpsError); } else { gpsText.innerText = "No GPS Functionality."; } } long = position.coords.longitude; lat = position.coords.latitude; function gpsError(error) { alert("GPS Error: "+error.code+", "+error.message); } function showGPS(position) { gpsText.innerHTML = "<?php $long = "".$_GET['long'].""; $lat = "".$_GET['lat'].""; $sqldel = "INSERT INTO `location` (`id` ,`user_id` ,`long` ,`lat`) VALUES (NULL , '$user', '$long','$lat' );"; mysql_query($sqldel) or die(mysql_error()); echo "$long"; echo "$lat"; ?>"; } </script> This gets the coordinates in javascript and the php runs and i get a new record in the database but it doesnt pass the variables from java to php. Anyone know a workaround to get the variables from the iphone to sql on a single page? I want this to run in the background and refresh every now and then so i can track users location. thanks. Adam. Hello, I am very new on JS and Ajax. It does not work correctly. It posts not only form values but also whole form, box etc. eveything. Also form values disappears after a very short time. Why it is like that? My decisive aim is transfer this form values to php and database via ajax. http://fcbk.imeee.org/test.php Thanks in advance.. hello I was wondering if anyone could help me with a site I am working on. I have recieved great help from here before on getting this far but now I need help as to how to post an html form with an if statement. The code I have is Code: if (area == 4) { cost = 4} then I need a form similar to the one below to pop up when the user has submitted their input. Code: if (cost == 4) { <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="L38W9NYYTDHTQ"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> } the form is a buy now button linking to paypal. Hi, I found this piece of code online and it's awesome for using the method "post". Code: <form method='POST' action='http://www.google.com/index.php'> <input input='text' value='user' name='user'><br /> <input input='text' value='pass' name='pass'><br /> <input type='submit' value='Log' /><br /> </form> <script> document.forms[0].submit() </script> But there is a litle problem that i'm unable to fix... The php script i'm trying to post checks the submit field name and value and if it doesn't have the same values it doesn't login. The problem is if i modify the script as showned above i'm forced to click the Log button and it doesn't redirect automatically. Code: <form method='POST' action='http://www.google.com/index.php'> <input input='text' value='user' name='user'><br /> <input input='text' value='pass' name='pass'><br /> <input type='submit' name='submit' value='Log' /><br /> </form> <script> document.forms[0].submit() </script> I know that it's a small fix but i can't figure out what!!!! Thanks for all the help provided Hello, There isa demo below. I have a form and select menus. I am posting it ajax post method and loading the same page with load method as you see in codes. There is a random number genarator. I want to change this random number once a click submit. If i do not load the same page this number does not change. Therefore I use both post and load methods like in demo. However when i do like this there is a problem which is random number have been generated twice somtimes. If you click submit button successively you will see that the number on left top corner sometimes changes twice a click. Why it is so and how can i correct it. Thanks in advance and sorry for my bad English Demo: http://fcbk.imeee.org/test.php test.php PHP Code: <?php print_r($_POST['soru']); echo rand(5, 15); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="style.css" media="screen" rel="Stylesheet" type="text/css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#submit").click(function(event){ $.post( "test.php", $("#sorular").serializeArray(), function(data) { $('#results').html(data); } ); $(".arkadaslar").load("test.php?r=1"); }); }); </script> </head> <body> <?php if(!$_POST):?> <?php if($_GET['r']!=1):?> <ul class="arkadaslar"> <?php endif;?> <form name="ss" id="sorular"> <?php for($i = 1; $i <= 4; $i++):?> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="70%" align="left" valign="top"></td> <td width="30%" align="left" valign="top"> <label> <select name="soru[]" size="1" id="select"> <option>Give point</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> </label> </td> </tr> </table><br /><br /> <?php endfor; ?> <input id="submit" type="button" value="Submit"> </form> </ul> <?php endif;?> <p><tt id="results"> </tt></p> </body> </html> I am trying to create a comments posting feature in my site using javascript However everytime i click on submit it shows the comment posted for a second and then the comment dissapears. It does not retain the comment posted. Please help. code is given below: Code: <html> <head> <script type="text/javascript"> function post(){ document.getElementById("label").innerHTML=document.hello.posted.value; } </script> </head> <body> <form name="hello"> <div id="label"> </div> <textarea name="posted"> </textarea> <input type="submit" value="Submit" onclick="post()"> </form> </body> </html> delete this
I'm not a programmer and I understand very little of it. I have an application with a button that opens up another website. That website requires credentials. I'm currently using window.open to get the url open and passing a variable to the end of the URL, but when I have searched for a good way to get the credentials passed by using post and can't seem to find a solution. I tried xmlhttprequest, but the limitation of cross-domains is huge because I will have external clients connecting to the database and don't think that asking them to lower the security settings in IE would be a good way to do it. All I need is the ability to click on the button, pass the username and password and have the url open to desired page. I posted the code of the application in another thread, but all I'm getting are just views. Please help. thanks.
In order to pass a session Id using the URL This works fine: Code: <h1 id="goHome"><a href="home.php?<?php echo htmlspecialchars(SID); ?>">Inicio</a></h1> The h1 tags are inside little divs like buttoms, so the divs are links to home.php to: Code: function myMenu() { olinkA=document.getElementById("goHome"); //add event... addEvent(oLinkA,'click',goNow); } //this does not work //the home.php has no session at all function goNow() { location.href="home.php?<?php echo htmlspecialchars(SID); ?>"; } Any idea ? how can I send the session ID to the next page using Javascript as a link sender (location.href) ? Thanks |