JavaScript - Getting A Session Id Inside Javascript
Hello everyone,
I have session_start() at the begining of my home page. In my home page I'm calling a fileName.js inside my <head></head> tags. My guestion is... How do I get the session id inside fileName.js? Or is there a way to pass it to fileName.js from the home page(index.html)? Thank You in advance. Similar Tutorialsim trying to incorporate a tweetme button....inside of my joomla myblog component i entered into the core html with php tags of the blog....went to the bottom and added in the javascript for the twitter button....it worked but i want the url of the twitter button to point to the specific url's of each blog post so i simply grabbed the php tag from the top of the post that determines the link for the title of the blog Code: <?php echo $e['permalink']; ?> this is the code i ended up with Code: <script type="text/javascript"> tweetmeme_url = '<?php echo $e['permalink']; ?>'; </script> <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script> it gave me a syntax error..... is there anyway to make this situation possible? I am currently creating a page to allow a user to change their password. I have a field which the user will enter their current password into and I am then using javascript to check whether this is the correct password. My passwords are encrypted using md5 and so I need to incorporate this into the javascript function. I have tried but unfortunately cannot get the correct value for the encrypted password. My javascript code is as follows... Code: function verifyCurrentPassword(){ //Gain the hashed password that is in the database var password; <?php print "password='" .$password. "';\n"; ?> //Find the password that the user has entered as the current password var hashedpassword; var currentpassword = document.getElementById("currentpassword").value; <?php print "hashedpassword='" .md5("currentpassword"). "';\n"; ?> if(password == hashedpassword){ alert("passwords are the same"); } } Hi all! I'm trying to make the width of an image relative to the width of the browser. I use this script to find the browser width: Code: var imageWidth = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; } imageWitdh = myWidth*0.3; Now I want my image to have the width equal to imageWitdh... how can I do this? <img src="someimage.png" width="imageWitdh"> doesnt work, abviously... Thanks a lot!!! Grts ok, so I have a code where it takes documents and uploads them as soon as selected. I want to know how I can put in my genRandomString() in so that not only will the doc upload, but this random string will submit to database, but I need this string to be the same for all documents that are uploaded on a single page load.....when page refreshes, new string, else it stays the same. I am going to link this number as an id in the database so that it can be identified. does this make any sense at all?????? Code: <?php function genRandomString($length = 20) { $characters = '0123456789'; $string =''; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters))]; } return $string; } ?> <!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>Multiple File Upload With Progress Bar - Web Developer Plus Demos</title> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript" src="js/swfupload/swfupload.js"></script> <script type="text/javascript" src="js/jquery.swfupload.js"></script> <script type="text/javascript"> $(function(){ $('#swfupload-control').swfupload({ upload_url: "upload-file.php", file_post_name: 'uploadfile', file_size_limit : "9999999999999999999999999999999999", file_types : "*", file_types_description : "Image files", file_upload_limit : 1000, flash_url : "js/swfupload/swfupload.swf", button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png', button_width : 114, button_height : 29, button_placeholder : $('#button')[0], debug: false }) .bind('fileQueued', function(event, file){ var listitem='<li id="'+file.id+'" >'+ 'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+ '<div class="progressbar" ><div class="progress" ></div></div>'+ '<p class="status" >Pending</p>'+ '<span class="cancel" > </span>'+ '</li>'; $('#log').append(listitem); $('li#'+file.id+' .cancel').bind('click', function(){ //Remove from queue on cancel click var swfu = $.swfupload.getInstance('#swfupload-control'); swfu.cancelUpload(file.id); $('li#'+file.id).slideUp('fast'); }); // start the upload since it's queued $(this).swfupload('startUpload'); }) .bind('fileQueueError', function(event, file, errorCode, message){ alert('Size of the file '+file.name+' is greater than limit'); }) .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){ $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued); }) .bind('uploadStart', function(event, file){ $('#log li#'+file.id).find('p.status').text('Uploading...'); $('#log li#'+file.id).find('span.progressvalue').text('0%'); $('#log li#'+file.id).find('span.cancel').hide(); }) .bind('uploadProgress', function(event, file, bytesLoaded){ //Show Progress var percentage=Math.round((bytesLoaded/file.size)*100); $('#log li#'+file.id).find('div.progress').css('width', percentage+'%'); $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%'); }) .bind('uploadSuccess', function(event, file, serverData){ var item=$('#log li#'+file.id); item.find('div.progress').css('width', '100%'); item.find('span.progressvalue').text('100%'); var pathtofile='<a href="uploads/'+file.name+'" rel="nofollow" target="_blank" >view »</a>'; item.addClass('success').find('p.status').html('Done!!! | '+pathtofile); }) .bind('uploadComplete', function(event, file){ // upload has completed, try the next one in the queue $(this).swfupload('startUpload'); }) }); </script> <style type="text/css" > #swfupload-control p{ margin:10px 5px; font-size:0.9em; } #log{ margin:0; padding:0; width:500px;} #log li{ list-style-position:inside; margin:2px; border:1px solid #ccc; padding:10px; font-size:12px; font-family:Arial, Helvetica, sans-serif; color:#333; background:#fff; position:relative;} #log li .progressbar{ border:1px solid #333; height:5px; background:#fff; } #log li .progress{ background:#999; width:0%; height:5px; } #log li p{ margin:0; line-height:18px; } #log li.success{ border:1px solid #339933; background:#ccf9b9; } #log li span.cancel{ position:absolute; top:5px; right:5px; width:20px; height:20px; background:url('js/swfupload/cancel.png') no-repeat; cursor:pointer; } </style> </head> <body> <div id="swfupload-control"> <p>Upload upto 5 image files(jpg, png, gif), each having maximum size of 1MB(Use Ctrl/Shift to select multiple files)</p> <input type="button" id="button" /> <p id="queuestatus" ></p> <ol id="log"></ol> </div> </body> </html> in a javascript file that contains the following code, is there a way to hyperlink the word ELEPHANT ? $j('#message').html("white ELEPHANT"); Hello, I'm developing very simple web site for my gym. It has a main page, index.php and several secondary pages e.g. home.php, services.php, location.php. Secondary pages are reachable via php script called through navigation bar located in index.php. Once it's called the pages are loaded inside a main frame, which is located in index.php as well. Everything works fine, except when I add javascript code (which presents map of the gym) inside location.php site. Body of location.php looks like this: <body> <h2>Lokacije fitness centara<br></h2> <p>"Fitness centar Adam"</p> <script type="text/javascript" src="http://www.karte.hr/api.js?v=1.0"> </script> <div id="karte_hr_karta" style="border:1px solid #C5C5C5;width:450px; height:400px;"> <a href="http://www.karte.hr/karta/g-l-fitness-adam-i-eva">Interaktivna karta Hrvatske | Interactive map of Croatia</a> <script type="text/javascript"> new karteHR({container:"karte_hr_karta", slider:true, onload:function() { this.viewer.setViewBound(2452469, 5064256, 2471292, 5073038); this.kartehr.loadMyMap({mid:43425, nosetbound:true}); }}); </script>" </div> </body> When I call location.php through navigation bar from index.php, the whole page reloads (instead of main frame only). It really gets on my nerves - just can see 2-3 milliseconds an empty page until the whole page appears... I'm not really familiar with Javascript neither with PhP, but I assume it's because of onload:function(). I got this code from map service from my country (http://www.karte.hr/). I've tried to change it but it didn't work and now I have absolutely no idea what to do. If it's permitted I can post a link to this web site so you can easily understand my issue. Thank you very much. Aleksandra I have multiple <?php require("../section.php"); ?> on my pages and I would like to insert some Javascript (for Facebook's social bookmarks plugins) in one of these so that it comes right before the </body> tag. Currently my "footer.php" require is in that position so I open the footer.php and place the Javascript at the end. Code: <?php echo ' Footer Content Here's my Javascript '; ?> It gives a syntax error in Dreamweaver halfway through the JS and the footer.php doesn't show at all when uploaded. Can you not insert JS this way? How would I do this? I don't know anything about Javascript so be easy. Hi, I am making a small software which will require activation. My problem is when I activate my software after checking the key through my website I want to enter some information in registry of the user. Now my problem is when I check the value through my website how can I return after verification to the local computer. is it possible if I create a session variable or some other type of variable (not sure what type) and then read that variable on user computer. If that matches I will enter the code in registry. Code: document.cookie = "score=400"; var x = document.cookie ; alert("Time Up"); window.location.href = "main.php?option=insert_result&result=" + x; In main.php I have a code that will save data on database. My question is why is that it saved something like score=200; PHPSESSID=m5v9qp5c9trcmfi9mso91b7nh5. All I want is 200 to be saved Hello, first thing I'd like to say is that I honestly have little knowledge of javascript(never wanted to learn it to be honest). However, I was looking at my websites code, and I'm wondering if you can add html inside javascript. What I mean is something like this: Code: <script type="text/javascript"> var d = false; if(d == true){ </script> true <li class="right"><a href="login.php">Log In</a></li> <li class="right"><a href="register.php">Register</a></li> <script type="text/javascript"> }else{ </script> false <?php die();?> <script type="text/javascript"> } </script> Sorry is this is stupid. I have a stupid problem... Page 1 and Page 2 have a link to Page 3 Page 3 is a html page, the frame source is Page 4 There is a javascript:history.go(-1) link on Page 4. I want to go back to page 1 (not inside the frame, i want it to go back to the previous page just like when you click the "back" button of your browser) or go back to page 2 (whichever one is the last page) but the link doesn't work because it's inside a frame... If i go directly to page 4 without using the page with the frame (page 3) the link will work and get me back to page 1 or page 2... some help would be appreciated !! OK, so I have this table I am putting on a new website I am building. The table works great. Does exactly what I want it to do, except for one thing. Here's the code for the table: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["table"]}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Artist'); data.addColumn('string', 'Title'); data.addColumn('string', 'Song #'); data.addRows([ ['Colin Hay', 'Overkill (Men at Work Acoustic)', 'GKK-02'], ['Colin Hay', 'Waiting for My Real Life to Begin', 'GKK-01'], ['Lindsey Buckingham', 'Big Love (Fleetwood Mac Acoustic)', 'GKK-03'] ]); var table = new google.visualization.Table(document.getElementById('table_div')); table.draw(data, {showRowNumber: true}); } </script> </head> <body> <div id="table_div"></div> </body> </html> Now, here's the problem. In the third column, I need to insert a unique hyperlink for each song # in each row. When I try to add a hyperlink, it shows the code instead of a link. I am a coding NOVICE. Everything I know, I have taught myself. The solution to this is escaping me. Please help? Reply With Quote 12-31-2014, 02:11 AM #2 CanYouDigIt View Profile View Forum Posts New Coder Join Date Dec 2014 Posts 14 Thanks 1 Thanked 0 Times in 0 Posts Also.... forum admin.... please edit my typo in the thread title so I don't look like more of an idiot than I actually am. Thanks. Reply With Quote 12-31-2014, 03:37 AM #3 Kharahs View Profile View Forum Posts New to the CF scene Join Date Dec 2014 Posts 2 Thanks 0 Thanked 0 Times in 0 Posts I'm fairly new to javascript (but have quite a bit of experience working with HTML and CSS - also self taught) so I could be misunderstanding, but are you using something along the lines of... Code: <a href="http://etcetc.com">Text you want the hyperlink applied to</a> ...for the hyperlink? Reply With Quote 12-31-2014, 03:39 AM #4 CanYouDigIt View Profile View Forum Posts New Coder Join Date Dec 2014 Posts 14 Thanks 1 Thanked 0 Times in 0 Posts Originally Posted by Kharahs I'm fairly new to javascript (but have quite a bit of experience working with HTML and CSS - also self taught) so I could be misunderstanding, but are you using something along the lines of... Code: <a href="http://etcetc.com">Text you want the hyperlink applied to</a> ...for the hyperlink? Exactly correct. But that code is not functioning inside the javascript for the table. Reply With Quote 12-31-2014, 04:18 AM #5 Kharahs View Profile View Forum Posts New to the CF scene Join Date Dec 2014 Posts 2 Thanks 0 Thanked 0 Times in 0 Posts Create link in an html table with javascript - Stack Overflow - looks like a similar issue? One of the responses may have a clue Reply With Quote 12-31-2014, 04:31 AM #6 low tech View Profile View Forum Posts Regular Coder Join Date Dec 2009 Posts 905 Thanks 177 Thanked 104 Times in 104 Posts Hi I haven't worked with this before but something like this maybe as an example would produce links on song column example link <a href="http://www.example.com/GKK-01">GKK-01</a> PHP Code: <div id="table_div"></div> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["table"]}); google.setOnLoadCallback(drawTable); function drawTable() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Artist'); data.addColumn('string', 'Title'); data.addColumn('string', 'Song #'); data.addRows([ ['Colin Hay', 'Overkill (Men at Work Acoustic)', 'GKK-02'], ['Colin Hay', 'Waiting for My Real Life to Begin', 'GKK-01'], ['Lindsey Buckingham', 'Big Love (Fleetwood Mac Acoustic)', 'GKK-03'] ]); var table = new google.visualization.Table(document.getElementById('table_div')); var formatter = new google.visualization.PatternFormat( '<a href="http://www.example.com/{1}">{0}</a>'); // Apply formatter and set the formatted value of the first column. formatter.format(data, [2, 2]); //table.draw(data, {showRowNumber: true}); table.draw(data, {allowHtml: true, showRowNumber: true}); } </script> Hi I'm trying to finish integrating my affiliate program and i'm having problems on the last bit.. basically how do i get this to work? basically i need the id token to be displayed... Code: <input name="radiobutton" type="radio" onclick="window.location.href='http://tracking.alpharooms.com/idevaffiliate.php?alpha_id=552&alpha_keyword= <script language="JavaScript" type="text/javascript" src="http://www.theholidaymakers.me.uk/affiliates/display.php?token=id"></script> &alpha_url=http://www.alpharooms.com/cheap-flights.aspx/?cob=64'; " value="radiobutton" /> the display.php file is below PHP Code: <?PHP ############################################################# ## iDevAffiliate Version 5.2 ## Copyright - iDevDirect.com L.L.C. ## Website: [url]http://www.idevdirect.com/[/url] ## Support: [url]http://www.idevsupport.com/[/url] ## Email: [email]support@idevdirect.com[/email] ############################################################# /* -------------------------------------------------------------- You can alter the CSS below but do not remove the Java Script Tags. They are required because this file is being called via Java Script. Any invalid coding adjustments to this page will result in Java Script errors in the page you've placed the Java Script code snippet. Adjustments to this file are not supported by iDevDirect. We highly suggest making a backup of the original display.php file before making changes. If you're wondering what the variable $idev represents, that is the affiliate ID number and is obtained from the /includes/tracking.php file. -------------------------------------------------------------- */ $token_tag_id = ""; $token_tag_username = "Affiliate Username"; $token_tag_phone = "Affiliate Phone"; $token_tag_name = "Affiliate Name"; $token_tag_company = "Affiliate Company"; $token_tag_city = "Affiliate City"; $token_tag_state = "Affiliate State"; $token_tag_zip = "Affiliate Zip Code"; $token_tag_website = "Affiliate Website"; ?> document.write('<style type="text/css">'); document.write('<!--'); document.write('p.idev {'); document.write('font-size: 12px;'); document.write('font-family: Arial, Helvetica, sans-serif;'); document.write('font-weight: bold;'); document.write('}'); document.write('-->'); document.write('</style>'); <?PHP $time_now = time(); include ("API/config.php"); include ("includes/validation_functions.php"); include ("includes/tracking.php"); // SANITIZE AND SET INCOMING TOKEN VARIABLE // ----------------------------------------------------------- $token = check_type('token'); if ($idev) { // GET AFFILIATE DATA // ----------------------------------------------------------- $aff_data = mysql_query("select username, phone, f_name, l_name, company, city, state, zip, url from idevaff_affiliates where id = '$idev'"); if (mysql_num_rows($aff_data)) { $aff_data = mysql_fetch_array($aff_data); $affiliate_username = $aff_data['username']; $affiliate_phone = $aff_data['phone']; $affiliate_fname = $aff_data['f_name']; $affiliate_lname = $aff_data['l_name']; $affiliate_name = $affiliate_fname . " " . $affiliate_lname; $affiliate_company = $aff_data['company']; $affiliate_city = $aff_data['city']; $affiliate_state = $aff_data['state']; $affiliate_zip = $aff_data['zip']; $affiliate_website = $aff_data['url']; } } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE ID // ----------------------------------------------------------- if (($token == 'id') || (!$token)) { if ($idev) // ----------------------------------------------------------- { $token_id = $idev; } else { $token_id = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_id $token_id</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE USERNAME // ----------------------------------------------------------- if ($token == 'username') { if ($idev) // ----------------------------------------------------------- { $token_username = $affiliate_username; } else { $token_username = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_username: $token_username</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE PHONE // ----------------------------------------------------------- if ($token == 'phone') { if (($idev) && ($affiliate_phone)) // ----------------------------------------------------------- { $token_phone = $affiliate_phone; } else { $token_phone = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_phone: $token_phone</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE NAME // ----------------------------------------------------------- if ($token == 'name') { if (($idev) && ($affiliate_name)) // ----------------------------------------------------------- { $token_name = $affiliate_name; } else { $token_name = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_name: $token_name</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE COMPANY // ----------------------------------------------------------- if ($token == 'company') { if (($idev) && ($affiliate_company)) // ----------------------------------------------------------- { $token_company = $affiliate_company; } else { $token_company = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_company: $token_company</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE CITY // ----------------------------------------------------------- if ($token == 'city') { if (($idev) && ($affiliate_city)) // ----------------------------------------------------------- { $token_city = $affiliate_city; } else { $token_city = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_city: $token_city</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE STATE // ----------------------------------------------------------- if ($token == 'state') { if (($idev) && ($affiliate_state)) // ----------------------------------------------------------- { $token_state = $affiliate_state; } else { $token_state = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_state: $token_state</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE ZIP // ----------------------------------------------------------- if ($token == 'zip') { if (($idev) && ($affiliate_zip)) // ----------------------------------------------------------- { $token_zip = $affiliate_zip; } else { $token_zip = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_zip: $token_zip</p>\");"; } // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE WEBSITE // ----------------------------------------------------------- if ($token == 'website') { if (($idev) && ($affiliate_website) && ($affiliate_website != "http://")) // ----------------------------------------------------------- { $token_website = "<a href=\'$affiliate_website\' target=\'_blank\'>$affiliate_website</a>"; } else { $token_website = "N/A"; } // ----------------------------------------------------------- print "document.write(\"<p class='idev'>$token_tag_website: $token_website</p>\");"; } $affiliate_logo = "$logo_default"; // ----------------------------------------------------------- // DISPLAY TOKEN : AFFILIATE LOGO // ----------------------------------------------------------- if ($token == 'logo') { // ----------------------------------------------------------- // GET LOGO/IMAGE DATA // ----------------------------------------------------------- if (isset($idev)) { $logo_data = mysql_query("select filename from idevaff_logos where id = '$idev' and approved = '1'"); if (mysql_num_rows($logo_data)) { $logo_data = mysql_fetch_array($logo_data); $affiliate_logo = $logo_data['filename']; $logo_location = $base_url . "/logos/" . $affiliate_logo; } else { $logo_location = $logo_default; } } // ----------------------------------------------------------- list($width, $height, $type, $attr) = getimagesize("$logo_location"); // ----------------------------------------------------------- print "document.write(\"<img border='0' src='$logo_location' width='$width' height='$height'>\");"; } ?> HELP IS NEEDED, THANKS IN ADVANCE. Can anyone tell me role of () after a function or so and mainly the function of text inside it? for example how is function stuff (a) { } different from function stuff (b) { } or simply from function stuff () { } ? I have been looking all over the web for a solution, because my website displays funky in safari. To fix this i figured i'd tell users that if they are using safari, then using javascript, i could tell them a message. Originally i tried detecting safari then displaying a message. But i couldn't ever find a browser detection for safari. So i thought wait.... If i could: 1. get a javascript alert saying my message. 2. time that message alert frequency by a session, say 10 days? or even every browser session... Then i could solve my problem. However i can't figure out any of this. So if anybody would be willing to help, i'd be very grateful. I have a site where i switch between two images using some JavaScript. What I need is to be able to set a session variable or something so that if someone selects shading on or off it sticks to that for the rest of the session. Any idea or even a point in the right direction. Do i need cookies or is there a simple way to do this http://www.tech4t.co.uk/territorymapping/pentagon/ hello everybody, here I'm asking for help again. sorry for that in advance. anyhow, I have the following code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link type="text/css" media="screen" rel="stylesheet" href="colorbox.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="../colorbox/jquery.colorbox.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".example7").colorbox({width:"300px", height:"500px", iframe:true, open: true}); }); </script> </head> <body onload="example7();"> <a class='example7' href="tofes.html"></a> teststestestest </body> </html> I want the lightbox window open only once a day for every unique visitor on my website. I understand I should use some sort of cookie implented, but I dont really understand how to. Thanks in advance, daniel. Hi, I have a website where the user can navigate different categories by tab. The problem is, when they're on a tab other than the default one and they refresh the page or click to another page, it puts them back on the first tab. I know this can be solved by using a session cookie of some type, I just need some help on implementing it into my site. http://www.thatswhyimbroke.com/ - so you can see what i'm talking about. If you look at the different tabs: Price High, price low, food & drink, etc. I want the user to be able to go to one of those, click to page 2 or refresh, and still be on that tab. Any help would be much appreciated! Alright so I've been teaching myself php/javascript/html/joomla for the past couple weeks, learning as i go along. So bear with me if i seem like a total moron =p. I'm trying to run a script from a js file to add javascript to the website inside the iframe. I also would like the script to only be activated onclick(this is all in an article). To clarify my website has an iframe and this iframe contains a webpage from http://website987.com/. I want to run thescript.js on the website inside that iframe, to add javascript to that website, however i also only want to run this js file on the click of a link/button. I hope i'm being clear if I'm not please tell me and ill try to reiterate. I've been trying to get this to work for a while now and I feel like this is really simple and I'm asking a stupid question. However this is what I've got so far, currently this just redirects the iframe to the URL with my code on it(instead of actually running it).How could i edit this/what coding could I use to make it so thescript.js actually runs instead of it being just redirected? Reply With Quote Code: <?php $filename = 'thescript.js'; $path = '/media/system/js/'; // add the path parameter if the path is different than : 'media/system/js/' JHTML::script($filename, $path, true); // MooTools will load if it is not already loaded ?> Code: <HTML> <HEAD> <script language="javascript"> function loadOne() { parent.FRAME1.location.javascript: function('/media/system/js/thescript.js') } </script> </HEAD> <BODY> <iframe name="FRAME1" src="http://website987.com/" width="740" height="500" frameborder="0" scrolling="yes"></iframe> <a href="javascript:loadOne()">Click Here/a> </BODY> </HTML> Am i even on the right track? I've been testing out a billion different codes and I think it would be ridiculous to post them all so I was hoping someone could help me fix this code or at least point me in the right direction. I'm usually able to figure everything out on my own but I'm failing atm and I just need help on this one thing, I would be ever so thankful for any assistance provided, ! (BTW I'm also currently using the Joomla CMS and a joomla plugin called CodeMirror that runs your code directly from the article, not sure if this is relevent or not) hi i'd like to ask how can i ask for a function inside a for loop , if i remove the loop the code works fine but i need it for 10 rows . please help , here is the code PHP Code: $content .=' <table cellspacing="2" cellpadding="2" border="0" align="center" > <SCRIPT LANGUAGE="JavaScript" type="text/JavaScript"> function doCalcAndSubmit() { // get both values kolicina1 = document.forms["vlez1"].kolicina.value; cena1 = document.forms["vlez1"].cena.value; // do some calculation vkupno1 = kolicina1 * cena1; // set the value in the right field document.forms["vlez1"].vkupno.value = vkupno1; } </script> <form id="vlez1" name="vlez1" method="POST" action="index_execute.php" > <tr valign="middle"> <td></td> <td align="center"><b> Sifra : </b></td> <td align="center"><b> Kolicina : </b></td> <td align="center"><b> Cena : </b></td> <td align="center"><b> Vkupno : </b></td> </tr> '; for($t=1;$t<11;$t++) { $content .= ' <tr valign="middle"> <td>'.$t.'.</td> <td><input type="text" id="sifra" autocomplete="off" name="sifra['.$t.']" align="middle" onblur="normalField(this);" onfocus="fireKeyListener_sifra(event); highlightField(this,1);" onkeyup="getList_sifra(event);" size="25" value="" /></td> <td><input type="text" id="kolicina" name="kolicina['.$t.']" align="middle" size="25" ></td> <td><input type="text" id="cena" name="cena['.$t.']" align="middle" size="25" onblur="doCalcAndSubmit();"></td> <td><input type="text" id="vkupno" disabled name="vkupno['.$t.']" align="middle" size="25" ></td> <input type="hidden" name="hidden_data" value="'.$data.'"> </tr>'; } $content .= '<tr> <td></td> <td></td> <td align="center"><input type="submit" id="submit2" name="submit2" value="Potvrdi" ></td> </tr> </form> </table> '; |