JavaScript - How To Pass Value To Newly Opened Webpage?
Similar TutorialsHere is the program: http://www.1728.com/newwindow.htm Basically, I want to input a number in the input box, which assigns a number to the variable numval located at document.box1.b1. When clicking on the "new window" button, an alert displays the input box value, then another window opens and displays the integers 1 through 12 and the amount squared. I would like the new window to obtain the number from the previous window so that the new window will display integers (and their squares) from 1 to the value of numval. Here is my scenario, i have a html that allows the user to retrieve .pdf file from the server. If the users are trying to open the html again, mean the user open a new tab/window to the same html url, the window will prompt the user that the html is already opened. The user will need to close the old html tab/window first before open a new one. Is it possible to stop the users to open the new same html file before he/she closes the old one ? Is there any link that teach the tutorial about this ? I am wondering do i need to use cookies in the browser to store the url in order to compare to the new tab/window url ? Thanks for helping. I appreciate this a lot. Hello, I am trying to get this sliding panel to automatically be open when the page loads. Right now it is closed and I need to click it to open. I would like for it to be automatically opened when the page first loads and click to close it. Can anyone help me with the coding? Here is the code: <!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>Demo</title> <style type="text/css"> @import url(style.css); </style> <script src="jquery.js" type="text/javascript"></script> <script src="javascript.js" type="text/javascript"></script> </head><body> <center> <div class="contenta"><img src="4.jpg" /></div> <div id="header"> <img src="2.jpg" width="938" height="68" border="0" /> </div> <div id="page_container"> <div id="toppanel"> <div style="height: 0px; display: block;" id="panel"><img src="1.jpg" width="938" height="583" /></div> <div class="panel_button" style="display: block;"><a href="#">Expand</a></div> <div class="panel_button" id="hide_button" style="display: none;"><a href="#">Close</a></div> </div> <div id="content"><img src="5.jpg" /></div> </div> </center> </body></html> and javascript.js $(document).ready(function() { $("div.panel_button").click(function(){ $("div#panel").animate({ height: "400px" }) .animate({ height: "300px" }, "fast"); $("div.panel_button").toggle(); }); $("div#hide_button").click(function(){ $("div#panel").animate({ height: "0px" }, "fast"); }); }); and css: body { text-align: center; margin: 0px; background: #000; } #page_container { position: relative; margin-left: 0px; margin-right: 0px; width: 938px; } #header { margin-left: 0px; margin-right: 0px; width: 938px; background: #111; } .panel_button { margin-left: 0px; margin-right: 0px; position: relative; top: -25px; padding-top: 5px; width: 100px; height: 22px; background: url(images/panel_button.png); z-index: 20; filter:alpha(opacity=70); -moz-opacity:0.70; -khtml-opacity: 0.70; opacity: 0.70; cursor: pointer; } .panel_button img { position: relative; top: 10px; } .panel_button a { text-decoration: none; color: #FFF; font-size: 12px; font-weight: bold; position: relative; font-family: Arial, Helvetica, sans-serif; } .panel_button a:hover { color: #999999; } #wrapper { margin-left: 0px; margin-right: 0px; width: 100%; text-align: center; } #toppanel { width: 100%; left: 0px; top: 0px; z-index: 25; text-align: center; } #panel { width: 938px; position: relative; top: 1px; height: 0px; margin-left: 0px; margin-right: 0px; z-index: 10; overflow: hidden; text-align: left; } #panel_contents { background: black; filter:alpha(opacity=70); -moz-opacity:0.70; -khtml-opacity: 0.70; opacity: 0.70; height: 100%; width: 938px; position: relative; z-index: -1; } #content { margin-left: 0px; margin-right: 0px; width: 100%; position: relative; text-align: left; color: #545454; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } div.contenta { width: 938px; margin-left: 0px; margin-right: 0px; } Thank you. Hi, I have a thumbnail gallery on my website. The thumbnails can be opened in a new window using: Code: <a href="/images/flowers22.jpg" rel="nofollow" target="_blank"><img src="images/flowers.jpg" alt="flowers" onClick="MM_openBrWindow('/images/flowers22.jpg','','status=yes,width=630,height=379');return false" /></a> I have inserted javascript code into my .js stylesheet to disable the right clicking of images on the page where the thumbnails a Code: var clickmessage="Apologies, images cannot be copied." function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images[i].onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() However, when the images open in a new window, the 'no right click' function does not apply. Does anyone know how to disable the right click for the newly opened images? Many thanks! My question is twofold. First, is there a way to have a javascript file display an externally hosted image when opened with a browser? I mean such a way where the URL of the javascript file can be referenced by an html document and display an image? Furthermore, is there a way to have this be a different image depending on the time of day and timezone of the user, specifically one image in the morning and a different image in the evening? I apologize if I posted this in the wrong section, but I wasn't sure where else this could go. Hello guys. I've been struggling on how to make this work. I have a problem in Javascript when it comes to passing of value in a input type field. page1.html Code: <html> <head><title></title></head> <form action="" method="post> <input type="text" name="weight" value=""><a href="hw_calculator.html" target="name" onclick="window.open('hw_calculator.html','name','height=270,width=370,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes'); return false;"> calculate </a> </form> </html> hw_calculator.html Code: <html> <head> <title> Height Converter (Metric/Standard) </title> </head> <body> <FORM> <INPUT type=hidden value="(Math.round((P.value * 0.45359)*100))/100" name=K_expr> <INPUT type=hidden value="(Math.round((K.value / 0.45359)*100))/100" name=P_expr> <INPUT type=hidden value="(Math.round((F.value * 30.48 + I.value * 2.54)*100))/100" name=C_expr> <INPUT type=hidden value="(Math.floor(C.value / 30.48))" name=F_expr> <INPUT type=hidden value="(Math.round(((C.value - (Math.floor(C.value / 30.48) * 30.48)) / 2.54)*100))/100" name=I_expr> <INPUT type=hidden value="(Math.round(P.value * 0.45359))" name=K_exprrnd> <INPUT type=hidden value="(Math.round(K.value / 0.45359))" name=P_exprrnd> <INPUT type=hidden value="(Math.round(F.value * 30.48 + I.value * 2.54))" name=C_exprrnd> <INPUT type=hidden value="(Math.floor(C.value / 30.48))" name=F_exprrnd> <INPUT type=hidden value="(Math.round((C.value - (Math.floor(C.value / 30.48) * 30.48)) / 2.54))" name=I_exprrnd> <h2>Height Converter</h2> <table border="0" bgcolor="#FFFF99" cellspacing="6" cellpadding="6"> <tr> <td colspan> <p class="conv" style="margin-top: 10px; margin-bottom: 10px"><b>STANDARD</b></p> </td> <td></td> <td colspan> <p class="conv" style="margin-top: 10px; margin-bottom: 10px"><b>METRIC</b></p> </td> </tr> <tr> <td> <p class="conv" style="margin-top: 10px; margin-bottom: 10px">Feet : <input maxLength=1 size=1 value=0 name=F> Inches : <input maxLength=2 size=1 value=0 name=I> </td> <td> <p class="conv" style="margin-top: 10px; margin-bottom: 10px"> = </p> </td> <td> <p class="conv" style="margin-top: 10px; margin-bottom: 10px"><input maxLength=3 size=1 value=0 name=C disabled> cm.</p> </td> </tr> <tr> <td class="conv" colspan="2"> <input type="button" name="Taste" value="Calculate" onclick="if (rounded.checked == true) { eval('C.value = ' + this.form.C_exprrnd.value); eval('K.value = ' + this.form.K_exprrnd.value) } else { eval('C.value = ' + this.form.C_expr.value); eval('K.value = ' + this.form.K_expr.value) }"> <INPUT type=checkbox name="rounded" value="rounded" checked disabled><font size="1" face="Verdana">Rounded Result</font> </td> </tr> </table> <p class="conv" style="margin-top: 10px; margin-bottom: 10px"> </body> </html> I want the value of Code: <input maxLength=3 size=1 value=0 name=C disabled> , this is from hw_calculator.html, to be passed on the Code: <input type="text" name="weight" value=""> on page1.html. How can I do this? Huge thanks. i have this code i need to close the parent.html window when the child window opened, i need the code for that working well in IE and Firefox Parent.html <HTML> <SCRIPT TYPE="text/javascript"> function sendTo() { window.open('child.html','_blank','resizable=yes,width='+(screen.width-500)+',height='+(screen.height-500)+''); } </SCRIPT> <BODY > <form name="form"> <input type="text" value="" name="text1" id="pdetails1"> <input type="text" value="" name="text1" id="pdetails2"> </br> <input type="submit" value="submit" onClick="sendTo()"> </BODY> </HTML> child.html <html> <body> <form> <input type=text name="text5" value=""> <input type=submit name="submit"value="submit"> </form> </body> </html> Hi!! I am trying to find out solution for this since long. I tried js but as I am not good with it, I just want to do this through PHP. I am adding dynamic rows when user clicks the Add Row button.I want to show the calculated amount like: line_total=qty*unit_price; PHP Code: if (isset($_POST['qty']) && sizeof($_POST['qty']) > 0) { for($i = 0, $maxi = count($_POST['qty']); $i < $maxi; $i++) { $quantity = (isset($_POST['qty'][$i]) && !empty($_POST['qty'][$i])) ? mysql_real_escape_string($_POST['qty'][$i]) : 0; $description = (isset($_POST['description'][$i]) && !empty($_POST['description'][$i])) ? mysql_real_escape_string($_POST['description'][$i]) : 0; $unit_price = (isset($_POST['unit_price'][$i]) && !empty($_POST['unit_price'][$i])) ? mysql_real_escape_string($_POST['unit_price'][$i]) : 0; $line_total = (isset($_POST['line_total'][$i]) && !empty($_POST['line_total'][$i])) ? mysql_real_escape_string($_POST['line_total'][$i]) : 0; ?> <?php $myvar=$quantity*$unit_price; ?> <script type="text/javascript"> jsvar = <?php echo $myvar; ?>; document.write(jsvar); // Test to see if its prints array: </script> } } This code works very well and displays the values.But if I use it in the function like; PHP Code: function line(elem) { jsvar = <?php echo $myvar; ?>; document.getElementById("line_total").value = jsvar; } And call it: PHP Code: <input type="text" name="line_total[]" id="line_total" onBlur="return line(this)"> It is not showing the result. Kindly guide me where I am going wrong? This is my function to add rows: PHP Code: <script type="text/javascript"> function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; if(rowCount<3) { var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i<colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells[i].innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = ""; break; case "checkbox": newcell.childNodes[0].checked = false; break; case "select-one": newcell.childNodes[0].selectedIndex = 0; break; } } } else { alert("Maximum Limit Of 3 Rows Reached"); } } </script> Please help me hi in javascript section there is a variable namesd first is available. i want to pass the value of this variable in a php variable. how can i do this.. Is it possible to pass the id onChange like in this example instead of the value This is part of a large complex script, and I need the id as seperate function Code: <select name='color' onChange='this.form.F1.value=this.form.color.id' > <option value='Green' id='c1'>Green <option value='Red' id='c2'>Red <option value='Blue' id='c3'>Blue </select> <input type="text" name="F1" size="15" value="" onChange="this.value=this.form.color.id"> I'm using a geolocator service to find the zipcode of a web page visitor using the code below. This will be used to serve up ads to the visitor based on their zip code. The question is, how do I pass the zip code value from the script into an ASP variable, such as a cookie or session object? <script language="JavaScript" src="http://www.iplocationtools.com/iplocationtools.js?key=my_site_key"></script> <script language="JavaScript"> <!-- document.write(ip2location_zip_code()); //--> </script> Here is my code <script language="javascript" type="text/javascript"> function revealModal(divID) { window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; }; document.getElementById(divID).style.display = "block"; document.getElementById(divID).style.top = document.body.scrollTop; } function hideModal(divID) { document.getElementById(divID).style.display = "none"; } </script> <div id="modalPage3"> <div class="modalBackground"></div> <div class="modalContainer"> <div class="modal53"> <div class="modalTop"><a href="javascript:hideModal('modalPage3')">[X]</a></div> <div class="modalBody"> <?php echo 'value='.$_SERVER['value']; ?> <h3><center>Choose from the options below</center></h3> <center><div id="stylized" class="myform"> <a href="javascript:hideModal('modalPage3');javascript:revealModal('modalPage1')" tabindex="2" title="Remove UPCAT Passer"><img src="images/photo_remove.png" /></a> <a href="javascript:hideModal('modalPage3');javascript:revealModal('modalPage2')" tabindex="4" title="Edit UPCAT Passer"><img src="images/photo_edit.png" /></a> <a href="javascript:hideModal('modalPage3');javascript:revealModal('modalPage4')" tabindex="4" title="Change Status of UPCAT Passer"><img src="images/photo_up.png" /></a> </div></center> </div> </div> </div> </div> <a href=javascript:revealModal('modalPage3');> <img src=images/option.jpg /></a> my problem is this one..how can I pass a value example value=3 to be like href= index.php?value=3..PLEASE HELP!!! Hi All, have a script which already passes one varible from a php script to my js script but i am having trouble trying to pass another one. here is my php code PHP Code: <?php include("config.php"); $keyword = $_POST['data']; $sql = "select prodName from ".$db_table." where ".$db_column." like '".$keyword."%' limit 0,10"; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result)) { echo '<ul class="list">'; while($row = mysql_fetch_array($result)) { $prodCat = $row['category']; $str = $row['prodName']; $start = strpos($str,$keyword); $end = similar_text($str,$keyword); $last = substr($str,$end,strlen($str)); $first = substr($str,$start,$end); $link = ""; $final = '<span class="bold">'.$first.'</span>'.$last; echo '<li><a href="'.$link.'">'.$final.'</a></li>'; } echo "</ul>"; } else echo 0; ?> and here is my original js code Code: $(document).ready(function(){$(document).click(function(){$("#ajax_response").fadeOut('slow');});$("#keyword").focus();var offset=$("#keyword").offset();var width=$("#keyword").width()-2;$("#ajax_response").css("left",offset.left);$("#ajax_response").css("width",width);$("#keyword").keyup(function(event){var keyword=$("#keyword").val();if(keyword.length) {if(event.keyCode!=40&&event.keyCode!=38&&event.keyCode!=13) {$("#loading").css("visibility","visible");$.ajax({type:"POST",url:"ajax_server.php",data:"data="+keyword,success:function(msg){if(msg!=0) $("#ajax_response").fadeIn("slow").html(msg);else {$("#ajax_response").fadeIn("slow");$("#ajax_response").html('<div style="text-align:left;">No Matches Found</div>');} $("#loading").css("visibility","hidden");}});} else {switch(event.keyCode) {case 40:{found=0;$("li").each(function(){if($(this).attr("class")=="selected") found=1;});if(found==1) {var sel=$("li[class='selected']");sel.next().addClass("selected");sel.removeClass("selected");} else $("li:first").addClass("selected");} break;case 38:{found=0;$("li").each(function(){if($(this).attr("class")=="selected") found=1;});if(found==1) {var sel=$("li[class='selected']");sel.prev().addClass("selected");sel.removeClass("selected");} else $("li:last").addClass("selected");} break;case 13:$("#ajax_response").fadeOut("slow");$("#keyword").val($("li[class='selected'] a").text());searchValue=document.getElementById('keyword').value;window.location="/dvd/"+searchValue+".php";break;}}} else $("#ajax_response").fadeOut("slow");});$("#ajax_response").mouseover(function(){$(this).find("li a:first-child").mouseover(function(){$(this).addClass("selected");});$(this).find("li a:first-child").mouseout(function(){$(this).removeClass("selected");});$(this).find("li a:first-child").click(function(){$("#keyword").val($(this).text());$("#ajax_response").fadeOut("slow");});});}); and i tryed to pass the $prodCat value by changing the above code and adding the code in red Code: $(document).ready(function(){$(document).click(function(){$("#ajax_response").fadeOut('slow');});$("#keyword").focus();var offset=$("#keyword").offset();var width=$("#keyword").width()-2;$("#ajax_response").css("left",offset.left);$("#ajax_response").css("width",width);$("#keyword").keyup(function(event){var keyword=$("#keyword").val(); var category=$("#prodCat").val(); if(keyword.length) {if(event.keyCode!=40&&event.keyCode!=38&&event.keyCode!=13) {$("#loading").css("visibility","visible");$.ajax({type:"POST",url:"ajax_server.php",data:"data="+keyword,success:function(msg){if(msg!=0) $("#ajax_response").fadeIn("slow").html(msg);else {$("#ajax_response").fadeIn("slow");$("#ajax_response").html('<div style="text-align:left;">No Matches Found</div>');} $("#loading").css("visibility","hidden");}});} else {switch(event.keyCode) {case 40:{found=0;$("li").each(function(){if($(this).attr("class")=="selected") found=1;});if(found==1) {var sel=$("li[class='selected']");sel.next().addClass("selected");sel.removeClass("selected");} else $("li:first").addClass("selected");} break;case 38:{found=0;$("li").each(function(){if($(this).attr("class")=="selected") found=1;});if(found==1) {var sel=$("li[class='selected']");sel.prev().addClass("selected");sel.removeClass("selected");} else $("li:last").addClass("selected");} break;case 13:$("#ajax_response").fadeOut("slow");$("#keyword").val($("li[class='selected'] a").text());searchValue=document.getElementById('keyword').value; searchCategory=document.getElementById('category').value; window.location=" /"+searchCategory+"/"+searchValue+".php ";break;}}} else $("#ajax_response").fadeOut("slow");});$("#ajax_response").mouseover(function(){$(this).find("li a:first-child").mouseover(function(){$(this).addClass("selected");});$(this).find("li a:first-child").mouseout(function(){$(this).removeClass("selected");});$(this).find("li a:first-child").click(function(){$("#keyword").val($(this).text());$("#ajax_response").fadeOut("slow");});});}); but this breaks the js code and it prevents it from running any ideas what ive done wrong? thanks Luke Hey I have a JS value but it won't put the value in the brackets when i try to get the element by ID instead it is looking for the id named the same as the variable name. Here is what i got to explain better: Code: function fill_div(v) { document.getElementById(v).innerHTML="<img src='untitle.png' style='width:100%;height:100%;'/>"; } var x = 0; var y = 3; var area = 1; window.onload = fill_div(area+':'+x+':'+y); It ends up looking for id v instead of id 1:0:3. Any idea how i correct this ? Here's my code Code: (function() { var GOOGLE_PLUS_SCRIPT_URL = 'https://apis.google.com/js/client:plusone.js'; var CHANNELS_SERVICE_URL = 'https://www.googleapis.com/youtube/v3/channels'; var VIDEOS_UPLOAD_SERVICE_URL = 'https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet'; var VIDEOS_SERVICE_URL = 'https://www.googleapis.com/youtube/v3/videos'; var INITIAL_STATUS_POLLING_INTERVAL_MS = 15 * 1000; var accessToken; $.getJSON( "the_key.txt", function( data ) { accessToken = data.access_token; function initiateUpload(e) { e.preventDefault(); var file = $('#file').get(0).files[0]; if (file) { $('#submit').attr('disabled', true); var gettags = $('#tags').val() var metadata = { snippet: { title: $('#title').val(), description: $('#description').val(), categoryId: 20, tags: ['"' + gettags.replace(/,/g , '", "') + '"'] }, }; $.ajax({ url: VIDEOS_UPLOAD_SERVICE_URL, method: 'POST', contentType: 'application/json', headers: { Authorization: 'Bearer ' + accessToken, 'x-upload-content-length': file.size, 'x-upload-content-type': file.type }, data: JSON.stringify(metadata) }).done(function(data, textStatus, jqXHR) { resumableUpload({ url: jqXHR.getResponseHeader('Location'), file: file, start: 0 }); }); } } function resumableUpload(options) { var ajax = $.ajax({ url: options.url, method: 'PUT', contentType: options.file.type, headers: { 'Content-Range': 'bytes ' + options.start + '-' + (options.file.size - 1) + '/' + options.file.size }, xhr: function() { // Thanks to http://stackoverflow.com/a/8758614/385997 var xhr = $.ajaxSettings.xhr(); if (xhr.upload) { xhr.upload.addEventListener( 'progress', function(e) { if(e.lengthComputable) { var bytesTransferred = e.loaded; var totalBytes = e.total; var percentage = Math.round(100 * bytesTransferred / totalBytes); $('#upload-progress').attr({ value: bytesTransferred, max: totalBytes }); $('#percent-transferred').text(percentage); $('#bytes-transferred').text(bytesTransferred); $('#total-bytes').text(totalBytes); $('.during-upload').show(); } }, false ); } return xhr; }, processData: false, data: options.file }); ajax.done(function(response) { var videoId = response.id; document.location="http://ez-gaming.net/index.php?app=videos&module=post§ion=submit&do=add_video&cat=&vidid=" + videoId; }); ajax.fail(function() { $('#submit').click(function() { alert('Not yet implemented!'); }); $('#submit').val('Resume Upload'); $('#submit').attr('disabled', false); }); } $(function() { $.getScript(GOOGLE_PLUS_SCRIPT_URL); $('#upload-form').submit(initiateUpload); }); }); })(); As you see I get JSON from the_key.txt and assign in to a variable. I call this variable later in the script but it doesn't seem to work. I did Code: alert(accessToken); after I put Code: $.getJSON( "the_key.txt", function( data ) { accessToken = data.access_token; and it worked and gave the correct string. But when I call accessToken in the initiateUpload function it does not work. AS shown he Code: function initiateUpload(e) { e.preventDefault(); var file = $('#file').get(0).files[0]; if (file) { $('#submit').attr('disabled', true); var gettags = $('#tags').val() var metadata = { snippet: { title: $('#title').val(), description: $('#description').val(), categoryId: 20, tags: ['"' + gettags.replace(/,/g , '", "') + '"'] }, }; $.ajax({ url: VIDEOS_UPLOAD_SERVICE_URL, method: 'POST', contentType: 'application/json', headers: { Authorization: 'Bearer ' + accessToken, 'x-upload-content-length': file.size, 'x-upload-content-type': file.type }, data: JSON.stringify(metadata) }).done(function(data, textStatus, jqXHR) { resumableUpload({ url: jqXHR.getResponseHeader('Location'), file: file, start: 0 }); }); } } Any ideas how to solve this? Hello. I am very new at using javascript and jquery. Right now Im working on a website, and it has a hierarchical menu in the right and im also doing some content loading in a div, all that with javascript. My problem is that when they click on a link, I need to pass a variable "id" through the link. I dont want to pass it in the url, but I want to pass it in another way, for every link the id is going to be different. How can I pass a variable to another page and how can I retrieve it in that page so I can use it for the content loading? Thanks! Hey there, I'm using the service from Maxmind to get user's postal code, what I wanna do is pass the value to the next page using GET function.. I am quite new to PHP, however I think I should name the variable first and call it on the next page right? But it doesn't seem to work. Any help is much appreciated! Thanks! I just stucked somewhere in js, i know its simple task but i don't know what's wrong but i believe i just need little guidance to get my result. Here is my problem Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>sample</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/javascript"> function OfferTwo(){ var Name = document.getElementById("txtName").value; var Email = document.getElementById("txtEmail").value; var sUrl = document.getElementById('offer2').src; document.getElementById('offer2').src = 'http://www.getmyname.com?info.php?dp=0&l=0&p=0&Name='+Name+'&email='+Email; alert(document.getElementById('offer2').src); } </script> </head> <body> <form name="myFrom" method="get" action=""> <p>Name <input name="txtName" type="text" id="txtName"> </p> <p>Email <input name="txtEmail" type="text" id="txtEmail"> </p> <p>Yes <input type="radio" name="rb" value="radiobutton" onClick="OfferTwo();"> No <input type="radio" name="rb" value="radiobutton"> </p> </form> <iframe name="offer2" id="offer2" src="" height="500px" width="100%" frameborder="0" scrolling="no">Your Browser not supporting</iframe> </body> </html> what i am trying to do on radio click 'YES' option i pass the value into querystring. Till now i got sucess to pass values but now problem is that how i pass this value into iframe src element. I tried alot did lot of googling but didn't get anything yet. Please help me, i know its very basic thing but i didn't trace my mistake. Thanks i n advance I want to pass the value to my object id = "Parameters" How can I do that? I had tried the code as posted below but it couldn't work. I'm using document.all.Parameters.data = tempParams[0]; to pass in the data to <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800 width=1060 VIEWASTEXT scroll=yes></OBJECT> I also have tried document.getElementById("Parameters").data = tempParams[0]; but still doesn't work. The code attached as below. PHP Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Management System Manual</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Sorry, you do not have permission to right click."); return false; } return true; } document.onmousedown=right; document.onmouseup=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); window.onmousedown=right; window.onmouseup=right; // End --> </script> <script type="text/javascript" language="JavaScript1.2"> <!-- // Begin //Disable right click script //no alert var message=""; /////////////////////////////////// function onKeyDown() { if ( (event.altKey) || ((event.keyCode == 8) && (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")) || ((event.ctrlKey) && ((event.keyCode == 82)) ) || (event.keyCode == 68) || (event.keyCode == 80) || (event.keyCode == 78) || (event.keyCode == 66) || (event.keyCode == 72) || (event.keyCode == 73) || (event.keyCode == 74) || (event.keyCode == 70) || (event.keyCode == 122) ) { event.keyCode = 0; event.returnValue = false; } } function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // End --> </script> <script type="text/javascript" language="JavaScript1.2"> function getParams() { var idx = document.URL.indexOf('?'); var idx1 = document.URL.indexOf('#'); var tempParams = new Object(); if (idx != -1) { var pairs = document.URL.substring(idx+1, idx1).split('?'); //pairs = 1; for (var i=0; i<pairs.length; i++) { nameVal = pairs[i].split('='); tempParams[0] = nameVal[1]; } } //document.getElementById("Parameters").data = tempParams[0]; //document.all.Parameters.data = tempParams[0]; document.all.Parameters.data = tempParams[0]; //alert (window.document.parameters.data); return false; } </script > </head> <style media="print"> body { display : none; } </style> </HEAD> </head> <!-- <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=setInterval("window.clipboardData.clearData();getParams();",2) oncontextmenu="return false" scroll=yes > --> <body ondragstart="return false" onselectstart="return false" onkeydown=onKeyDown() onload=getParams() oncontextmenu="return false" scroll=yes > <!--<input id="abc" type="text"/>--> <form id="frmRestricted" method="post"> <div id="Layer2" style="position:absolute; left:0px; top:-35px; width:1060; height:800; z-index:201"> <OBJECT id="Parameters" style="Z-INDEX: 200; LEFT: 0px; TOP: 0px; POSITION: ABSOLUTE;" type=application/pdf height=800 width=1060 VIEWASTEXT scroll=yes></OBJECT> </div> </form> </body> </html> Thank you very much I'm trying to echo a php variable to my javascript function but nothing is happening Basically this php page displays bunch of records with a radio button next to each record. So when the radio button is clicked it would open that record in a new window that is clicked. Code: <input type='radio' name='option' value='$ctr' id='$ctr' onClick="edit_record('<?php echo $ctr ?>')"> <script type="text/javascript"> function edit_record(){ var value = arguements[0]; alert("record id: " + value); window.open("Edit.php", "Edit Record", "status=1, height=400, width=900, resizable=0"); } |