using a php var in a js function - JavaScript Help


need a little help implementing a couple of php (or js) variables in this function:

function toggle_acuras() { var form = document.getElementById('Acura'); var thanks = document.getElementById('Acura1'); ((form.checked) Acura1.style.display='block': Acura1.style.display='none'); }
where i can use
function toggle_cars($variable) // toggle_cars($div_name) \t // { var form = document.getElementById('$checkbox_name'); var thanks = document.getElementById('$div_name'); ((form.checked) $div_name.style.display='block' : $div_name.style.display='none'); }
instead of writing 45 js functions... wouldn't this work somehow

the call is made in the checkbox input >> onclick="toggle_acuras();"

thanks in advance
GN

, this isn't working, but it looks like it should... doesn't carType have to be defined somewhere...
, makes great sense. didn't even think that far ahead. that's what i'll do, thanks much, for all your help.
Posted On: Wednesday 2nd of January 2013 12:37:43 AM Total Views:  277
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




JavaScript assign by value vs reference

Consider a simple example, e.g. var a = { 'a': 'b', 'c': 'd' } var k = a; 1. Is it assign by value (copying) or by reference) 2. If it is by value/reference, how to make them assign ...
VIEWS ON THIS POST

110

Posted on:

Friday 30th November 2012
View Replies!

What Am I Trying to Do??

, Everybody, Any resources dedicated to using JavaScript and CSS in the service of website **design**\t After some more reading here and there (particularly of "Web Standards Creativity"), it turns out that that's what I'm really trying to do: I ...
VIEWS ON THIS POST

78

Posted on:

Friday 30th November 2012
View Replies!

IE 7 and scripted windows?

, I thought I had hit on a way to pass a variable using 2 frames! The top frame uses a prompt to ask for an email address and then is succeeding pages I can access that value. But! It ...
VIEWS ON THIS POST

143

Posted on:

Friday 30th November 2012
View Replies!

State machine builder: looking for feedback

I've implemented a small internal "domain-specific language" (or rather a fluent interface) for defining finite state machines in JavaScript. The description of a simple machine looks like this var Machine = FSM.build(function(fsm) { with (fsm) { onUnexpectedEvent(function() { ... ...
VIEWS ON THIS POST

72

Posted on:

Friday 30th November 2012
View Replies!

File browser

I am looking for a solution to an online file browser. The browsing is not browsing a persons harddrive, so it is isn't really a file browser, but it is browsing a tree of strings generated by the server. Any ...
VIEWS ON THIS POST

89

Posted on:

Friday 30th November 2012
View Replies!

How to manage browser history?

I implement multiple upload with only iframe. Each upload occur only the previous upload is finished or no current upload is taken place. Each file upload has its own form. form has "target" attribute reference to an iframe in ...
VIEWS ON THIS POST

101

Posted on:

Friday 30th November 2012
View Replies!

InsertImage unselectable=on, remove focus

I'm using Google Groups to access newsgroups, and on here it doesn't look like any posts have shown up in this NG for about 36 hours. I've made 2 other threads in that time, and to my eyes none of ...
VIEWS ON THIS POST

64

Posted on:

Friday 30th November 2012
View Replies!

Sending a link from one iframe to another

On my page i have 2 iframes. If a link is clicked in iframe2, i want it to load the referenced page in iframe1. I tried target=iframe1 and that does not seem to be working. Is there a way ...
VIEWS ON THIS POST

73

Posted on:

Friday 30th November 2012
View Replies!

Array Help

Hi all, If I have an array with multiple entries that are the same. How can I split them up into separate arrays by this criteria var myArry = ("cars","cars","cars","cars","sticks","sticks","sticks","trees","trees"); The deed result would separate this array into 3 arrays. ...
VIEWS ON THIS POST

107

Posted on:

Friday 30th November 2012
View Replies!

list an object's properties

how can I do that I simply want to create a function which will list all properties of any object which is supplied as an argument to the function...
VIEWS ON THIS POST

82

Posted on:

Friday 30th November 2012
View Replies!

The Round-Trip Time of an XMLHTTP Call?

Hi. Can somebody tell me how to tell how long the round trip will take from client to server and back of an xmlhttp call I want to gauge how long the server code is going to crunch and return ...
VIEWS ON THIS POST

96

Posted on:

Friday 30th November 2012
View Replies!

modal popup

Can it be done that is, the user can only click the stuffs in the popup but not the opener. -- iTech Consulting Services Limited Expert in ePOS (Point-Of-Sales) solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288...
VIEWS ON THIS POST

88

Posted on:

Friday 30th November 2012
View Replies!

Javascript and firewalls...

I read on a CSS posting site where the author didn't like Javascript and dropdown menus because not all users can view them due to network and firewall restrictions. Then I noticed that MSN and Yahoo do not have any ...
VIEWS ON THIS POST

100

Posted on:

Friday 30th November 2012
View Replies!

Re: newbie: "array" of problems :( eech!

thanks to wisestpotato & Rob G for clarifiction. I did implement wise's change to the "showImage" function as a style-object of the body element and invoked with the onLoad function in the body tag. It works well! However!! one problem! ...
VIEWS ON THIS POST

73

Posted on:

Friday 30th November 2012
View Replies!

custom dll version

Hi all, I have a . js file with some basic code that I am compiling into a dll using jsc.exe. The problem is this generates at version # of 0.0.0.0. How can I change this Also, why no support ...
VIEWS ON THIS POST

101

Posted on:

Friday 30th November 2012
View Replies!

File extension of javascript file included in HTML

When using the following syntax, does the file extension matter For example, could I instead use where "foo.html" really contains javascript, not HTML My ISP provides an HTML-based host file editor that ...
VIEWS ON THIS POST

68

Posted on:

Friday 30th November 2012
View Replies!

iframe and showModalDialog

I have problem editing iframe in modal dialog. When executing test2.htm everything works fine, but when I open the same test2 in dialog editing is disabled! Any suggestions Example: Test1.htm ...
VIEWS ON THIS POST

90

Posted on:

Friday 30th November 2012
View Replies!

Infinite loop function inside function

I've spent hours just trying to figure out what the problem is and I'm just done. I get the error that the headache() method is not defined. I'm still not sure how the scope and nesting works in JS. Obviously something is up with that here. I've run the code as itself and it works. How do I get this to run I really don't understand the scope problems I'm having. I'm trying not to just write a blob of code and it's breaking my legs. Trying to take the loop function out so it's not nested works for the loop, but then I don't have access to the functions inside what I thought would be my main function.
VIEWS ON THIS POST

70

Posted on:

Sunday 23rd December 2012
View Replies!

How can i make an object array of class

Hi . i want to make array of objects from class customer > i wrote this code but it didn't work : so what i have to do exactly : function Accountant_program() { var counter=new Array(); for(i=0;i
VIEWS ON THIS POST

99

Posted on:

Sunday 23rd December 2012
View Replies!

pls.help me validate the dropdown box section of this form

this is my form   Pls. Note : fields must be completed in order to proceed. Job Title :      Posted :      Expires :      Industry :      --select-- Accountancy Catering Construction Customer Services Education Engineering House Keeping Human Resources IT Legal Services Logistics Management Media Medical Office & Admin Others Research Sales & Marketing Security Tourism Location :      --select-- Greater Accra Ashanti Central Volta Eastern Western Brong Ahafo Northern Upper East Upper West Required Skills / Experience :      How To Apply :      E-mail :      Job Description :              this is the javascript function validateForm() { var x=document.forms["myForm1"]["jobtitle"].value if (x==null || x=="") { alert("First name must be filled out"); myForm1.jobtitle.focus(); return false; } var x=document.forms["myForm1"]["todate"].value myForm1.todate.focus(); if (x==null || x=="") { alert("todate"); return false; } var x=document.forms["myForm1"]["todate2"].value myForm1.todate2.focus(); if (x==null || x=="") { alert("todate2"); return false; } var x=document.forms["myForm1"]["skill"].value myForm1.skill.focus(); if (x==null || x=="") { alert("skill"); return false; } var x=document.forms["myForm1"]["apply"].value myForm1.apply.focus(); if (x==null || x=="") { alert("apply"); return false; } var x=document.forms["myForm1"]["description"].value myForm1.description.focus(); if (x==null || x=="") { alert("description"); return false; } var x=document.forms["myForm1"]["email"].value var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos
VIEWS ON THIS POST

78

Posted on:

Sunday 23rd December 2012
View Replies!

If Image Exists?

I'm just finishing up an image gallery for a friend. It displays 4 thumbnails at a time, and I just realized if the gallery contains less than 4 images then one of them will get that ugly broken link image. I've created an image with the words "No Image" to replace these with, but I'm unsure about the best way to put it in. I realize that Javascript is client side, not server side, and that I can't simple check if the file exists. But can I use some kind of error handling techniques to accurately catch this problem and fix it Or would I be better off doing it with PHP This post has been edited by Ntwiles: 07 February 2011 - 12:24 AM
VIEWS ON THIS POST

95

Posted on:

Sunday 23rd December 2012
View Replies!

I Need a Crash Course in JavaScript for exam purposes.

I need to understand Javascript in the simplest, quickest possible way like ASAP. Can an expert help me plzzzzzzzzzzzzzzzz!!!!! This is my first time here, so I am not so sure how this work. This post has been edited by cafearon: 13 December 2009 - 04:08 PM
VIEWS ON THIS POST

84

Posted on:

Sunday 23rd December 2012
View Replies!

Javascript and Mysql?

I am trying trying to create a site that will require a database. (much like facebook functions) I am not new to programming, as I know Java and C++, but I am very new to the web development. For security reasons (so I have heard), I would like to write this site in php. At the same time, I may need some client sided code. (Or do I) I am not at all sure. I know that facebook is written in php, and the site I am making basically has the majority of those functions. Can anyone give me any inputs as to how I should go about choosing what language As of now, my partner is learning javascript and mysql, while I am studying php and mysql. I know that some sites implement both, javascript and php, but I was wondering if it is at all necessary to use both, and how would one know which code to write in what language.
VIEWS ON THIS POST

102

Posted on:

Monday 24th December 2012
View Replies!

Lightbox not displaying correctly in IE, works perfectly in FF

, I'm working on making a simple-as-possible lightbox using CSS + JS. When you click the link a bordered box pops up and the page "fades to black". In FF the black layer (which makes it look as if the rest of the page is darkened, like the "Lights Off" feature Hulu has) fades in and out properly and the box displays as the correct size. In IE 6 and 7 this is not the case (not tested with IE 8), the lightbox just appears, the black layer is not even present. Here is my code, maybe someone can give me a hand .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 300%; height: 300%; background-color: #000000; z-index:1001; -moz-opacity: 0.8; opacity: .8; filter:alpha(opacity=80); } .white_content { display: none; position: absolute; top: 25%; left: 25%; width: 50%; height: 50%; padding: 16px; border: 16px solid #3f3f3f; background-color: white; z-index:1002; overflow: auto; } function resetOp() { document.getElementById('dark').style.opacity = 0.0; document.getElementById('dark').style.MozOpacity = 0.0; document.getElementById('dark').style.filters = "alpha(opacity=0)"; } function fadein(alphaWhole) { var d = document.getElementById('dark'); if (alphaWhole == null) { alphaWhole = 0; } if (alphaWhole < 85) { d.style.opacity = alphaWhole/100; d.style.MozOpacity = alphaWhole/100; d.style.filters = "alpha(opacity=" + alphaWhole + ")"; alphaWhole += 5; window.setTimeout("fadein(" + alphaWhole + ")", 10); } else { alphaWhole = 80 } } function fadeout(alphaA) { var d = document.getElementById('dark'); var l = document.getElementById('light'); if (alphaA == null) { alphaA = 80; } if (alphaA === 0) { d.style.display='none'; l.style.display='none'; } else { d.style.opacity = alphaA/100; d.style.MozOpacity = alphaA/100; d.style.filters = "alpha(opacity=" + alphaA + ")"; alphaA -= 5; window.setTimeout("fadeout(" + alphaA + ")", 10); } } function toggleLightbox() { var d = document.getElementById('dark'); var l = document.getElementById('light'); if (d.style.display != 'block' && l.style.display != 'block') { resetOp(); d.style.display='block'; l.style.display='block'; fadein(); } else { fadeout(); } } Show Lightbox Lightbox here Close
VIEWS ON THIS POST

80

Posted on:

Monday 24th December 2012
View Replies!

compare dates with javascript

Okay, here is the scoop. I need to create a window of time that users are able to input data. the window is from Friday at 8am, until the next Monday at 11am. Im not sure how to code it since it goes over into the next week. can anyone help
VIEWS ON THIS POST

68

Posted on:

Monday 24th December 2012
View Replies!

Questions about JavaScript

Can Javascript be used to create an MMORPG If so, how can it help
VIEWS ON THIS POST

80

Posted on:

Monday 24th December 2012
View Replies!

Multiplication Product game

Good evening, I'm trying to make a program that generates 2 random integers and asks the user to input the product of them (in the document) after the user inputs the answer he clicks check to check the answer : 1 - If the answer is wrong a message is printed withing the same document "Incorrect please try again" and it returns to the same 2 integers. 2- If the answer is correct a message is printed"Very good" then a prompt window appears asking whether the user wants to answer another question or not . This is the code i've created : Solution 9.27 Input your answer: but when i run the script i don't get the qusetion part ! i just get the form I dunno exactly what are the errors i've made , any idea This post has been edited by dreamygirl: 17 March 2009 - 02:03 PM
VIEWS ON THIS POST

51

Posted on:

Monday 24th December 2012
View Replies!

2 functions with multiple parameters

! My professor wants us to use 2 functions to change the background and text colors for each of the buttons in this table. I'm confused on how to use multiple parameters to assign different background and text colors. Here is the code when I declare the function: ptw09 function changeBG() { alert(document.bgColor="purple") } function changeFG() { alert(document.fgColor="pink") } Here is the code when I call the function: Color Table Red Light Green Blue Black Yellow Olive Cyan White changeBG() changeFG() alert(document.bgColor="blue") alert(document.bgColor="black") alert(document.bgColor="yellow") alert(document.bgColor="olive") alert(document.bgColor="cyan") alert(document.bgColor="white") Thank You!
VIEWS ON THIS POST

84

Posted on:

Monday 24th December 2012
View Replies!

The very simply way to make a image slider by Javascript

Hi all! I found that is difficult to search a simple javascript code about scrolling image slide. You can find them on Internet but they often are long and complex or hidden from us to prevent edit. I just found a simple way to resolve this. I hope it will help your editting easier to make it yours! We need 2 div tag to make a slide. ChildDiv to store image array and ParentDiv to contain Child Div. Note: Image Array's Structure: [, ] Functions: DoSlide(), Make Slide to run. setmouse(param), set Slide play and pause when pointer over or out on images; Dr_ImgArr(); Print image array to HTML; getE(), getElementById(); DivWidth: Width of ParentDiv; MoreImage: Num Of Image on a begin of Image Array, insert into the last of ChildDiv to continue the Slide; .... If you have anymore comment, please reply here so that I can make it more perfect, thank for all. Demo: http://boy.us.com/Code/slide.php Style #ParentDiv { margin: auto; width: 600px; overflow: hidden; } #ChildDiv { width: 6000px; position:relative; cursor:pointer; } #ParentDiv img { float: left; padding: 3px; margin: 0px; } Javascript //Array Of Image, [URL, width of Image, LinkTo] var t; var StepTime=10; var StepPixel=1; var ImgPadding=3; var ParentDivLen=600; var Img= Array( ["./images/slide/3_116.jpg", 104, "../gal/gal=3&Type=image&ID=116"], ["./images/slide/4_250.jpg", 103, "../gal/gal=4&Type=image&ID=250"], ["./images/slide/1_157.jpg", 107, "../gal/gal=1&Type=image&ID=157"], ["./images/slide/2_120.jpg", 124, "../gal/gal=2&Type=image&ID=120"], ["./images/slide/4_229.jpg", 116, "../gal/gal=4&Type=image&ID=229"], ["./images/slide/3_173.jpg", 113, "../gal/gal=3&Type=image&ID=173"], ["./images/slide/2_192.jpg", 110, "../gal/gal=2&Type=image&ID=192"], ["./images/slide/4_111.jpg", 104, "../gal/gal=4&Type=image&ID=111"], ["./images/slide/5_244.jpg", 106, "../gal/gal=5&Type=image&ID=244"], ["./images/slide/5_279.jpg", 109, "../gal/gal=5&Type=image&ID=279"], ["./images/slide/5_233.jpg", 102, "../gal/gal=5&Type=image&ID=233"], ["./images/slide/5_256.jpg", 106, "../gal/gal=5&Type=image&ID=256"], ["./images/slide/5_248.jpg", 111, "../gal/gal=5&Type=image&ID=248"], ["./images/slide/3_143.jpg", 99, "../gal/gal=3&Type=image&ID=143"], ["./images/slide/1_225.jpg", 103, "../gal/gal=1&Type=image&ID=225"], ["./images/slide/4_103.jpg", 109, "../gal/gal=4&Type=image&ID=103"], ["./images/slide/4_145.jpg", 118, "../gal/gal=4&Type=image&ID=145"], ["./images/slide/5_263.jpg", 100, "../gal/gal=5&Type=image&ID=263"], ["./images/slide/2_115.jpg", 102, "../gal/gal=2&Type=image&ID=115"], ["./images/slide/4_140.jpg", 122, "../gal/gal=4&Type=image&ID=140"], ["./images/slide/1_214.jpg", 112, "../gal/gal=1&Type=image&ID=214"], ["./images/slide/3_142.jpg", 102, "../gal/gal=3&Type=image&ID=142"], ["./images/slide/5_297.jpg", 99, "../gal/gal=5&Type=image&ID=297"], ["./images/slide/4_168.jpg", 101, "../gal/gal=4&Type=image&ID=168"], ["./images/slide/5_277.jpg", 111, "../gal/gal=5&Type=image&ID=277"], ["./images/slide/5_296.jpg", 103, "../gal/gal=5&Type=image&ID=296"], ["./images/slide/4_169.jpg", 109, "../gal/gal=4&Type=image&ID=169"], ["./images/slide/4_244.jpg", 110, "../gal/gal=4&Type=image&ID=244"], ["./images/slide/5_285.jpg", 112, "../gal/gal=5&Type=image&ID=285"], ["./images/slide/3_100.jpg", 111, "../gal/gal=3&Type=image&ID=100"], ["./images/slide/1_103.jpg", 111, "../gal/gal=1&Type=image&ID=103"], ["./images/slide/1_119.jpg", 104, "../gal/gal=1&Type=image&ID=119"], ["./images/slide/5_253.jpg", 107, "../gal/gal=5&Type=image&ID=253"], ["./images/slide/4_183.jpg", 105, "../gal/gal=4&Type=image&ID=183"], ["./images/slide/4_171.jpg", 111, "../gal/gal=4&Type=image&ID=171"], ["./images/slide/2_147.jpg", 126, "../gal/gal=2&Type=image&ID=147"], ["./images/slide/3_115.jpg", 116, "../gal/gal=3&Type=image&ID=115"], ["./images/slide/5_310.jpg", 113, "../gal/gal=5&Type=image&ID=310"], ["./images/slide/4_185.jpg", 109, "../gal/gal=4&Type=image&ID=185"], ["./images/slide/3_159.jpg", 108, "../gal/gal=3&Type=image&ID=159"], ["./images/slide/2_154.jpg", 125, "../gal/gal=2&Type=image&ID=154"], ["./images/slide/5_314.jpg", 107, "../gal/gal=5&Type=image&ID=314"], ["./images/slide/2_106.jpg", 100, "../gal/gal=2&Type=image&ID=106"], ["./images/slide/4_123.jpg", 103, "../gal/gal=4&Type=image&ID=123"] ); var Pos=0; var Len=Img.length; var DivWidth=0; var MoreImage=0; function goURL(URLS) { document.location.href=URLS; } for(i=0;iParentDivLen)MoreImage=i; } function getE(id) { return document.getElementById(id); } function Dr_Img(IMG) { return ''; } function Dr_ImgArr() { var str=''; for(i=0;i
VIEWS ON THIS POST

81

Posted on:

Monday 24th December 2012
View Replies!

Using While Loops inside JavaScript

Help please. I need to create a page that prompts a user to enter a starting number and an ending number. I need to use a loop that displays all the numbers between the starting number and the ending number. For example, if the user entered 5 as the starting number and 9 as the ending number, the output would look like this: 5 6 7 8 9 This post has been edited by saa06: 29 April 2008 - 08:45 AM
VIEWS ON THIS POST

82

Posted on:

Monday 24th December 2012
View Replies!

Javascript branch to URL

I'm new to javascript. I've gotten the following code to work, but I don't know how to branch directly to the link (on identification of the browser) instead of requiring the viewer to click on the displayed text. var browser_name = navigator.appName if (browser_name == "Microsoft Internet Explorer") { document.write("Click Here To View Your Program In IE") } else { document.write("Click Here To View Your Program in a Browser Other Than IE") }
VIEWS ON THIS POST

69

Posted on:

Monday 24th December 2012
View Replies!

Drag and Drop Items - JavaScript Help

HiI am trying to create a draggable list of items, the code is belowJquery set up $(document).ready(function() { $("#accordion").accordion(); }); $(document).ready( function() { $("#sortme").sortable({ update : function () { serial = $('#sortme').sortable('serialize'); $.ajax({ url: "sort-events.php", type: "post", data: serial, error: function(){ alert("theres an error with AJAX"); } }); } }); } ); List of items 31st March - Steam train starts operating from Paignton to Dartmouth 31st March - 15th April - Easter Fun Fair Paignton 24th - 25th March Half price steam train rides on the Buckfastleigh/Totnes Line 6th - 8th April - Paignton Rugby Club Beer Festival When I go to the page, the items are not sortable/draggableWhat have I done wrong
VIEWS ON THIS POST

100

Posted on:

Friday 28th December 2012
View Replies!

Amazingly wierd image caption problem - JavaScript Help

Ok im going to try an give as much info as possible. Im using a plugin called jcapslide which can be found herehttp://tympanus.net/...caption-plugin/Its a image caption plugin that is cross browser compatible. Now each of my images an their info are drawn through a php query and displayed on the page. I then use this jcapslide to display extra info. However!!!!In all versions of IE the plugin works great. In Google crome it works great. Now If I refresh my page in google crome each image in the list displays on top of one another, moves out of position and the caption plugin completely stops working as a result. Here is my code. thanks //first the query to get 6 images $Fetchactivityq = mysql_query("SELECT name, description, image FROM activities WHERE club ='".$club['club']."' ORDER BY RAND() LIMIT 6 ") or die('activity error'); $activitynum = mysql_num_rows($Fetchactivityq); //then the loop to display the images \t // then the code at the bottom of the page for the caption $(document).ready(function() { $("[id^='capslide_img_cont']").capslide({ caption_color : 'white', caption_bgcolor : 'black', overlay_bgcolor : 'black', border : '', showcaption : true }); }); you also have to include some styles so here are the default styles .ic_container{ vertical-align:baseline; margin:10px; position:relative; /*-moz-border-radius:10px; -webkit-border-radius:10px; -khtml-border-radius:10px; -moz-box-shadow: 0 1px 3px #888; -webkit-box-shadow: 0 1px 3px #888;*/ } .overlay{ opacity:0.3; position:absolute; top:0px; bottom:0px; left:0px; right:0px; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50); } .ic_caption{ position:absolute; opacity:0.6; overflow:hidden; margin:0px; padding:0px; left:0px; right:0px; cursor:default; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=60); } .ic_category{ text-transform:uppercase; font-size:11px; letter-spacing:3px; margin:0px; } .ic_caption h3{ padding:0px 5px 5px 0px; margin:0px; font-size:14px; } .ic_caption h4{ padding:0px 5px 5px 0px; margin:0px; font-size:14px !important; } .ic_text{ padding:0px 5px 5px 0px; margin:0px; text-align:justify; font-size:10px; } .ic_caption a { color: rgb(255,204,0); } .ic_caption a:hover { color: rgb(255,204,0); text-decoration:underline; }
VIEWS ON THIS POST

64

Posted on:

Friday 28th December 2012
View Replies!

Two onchange events not working? - JavaScript Help

I have two events which i want to call in select while onchange I am uing this but its not working........
VIEWS ON THIS POST

269

Posted on:

Friday 28th December 2012
View Replies!

getting from mysql and streaming video - JavaScript Help

Well, I am not sure where to post this since it is using php and javascript.I am using OSFlvPlayer to stream the videos, the information for each video is in a mysql database. Using the $_GET php variable I am getting a value called id, I am then comparing the $id variable with the value called ID in the mysql database.The problem i am having is that it will not get the correct directory to get the videos, it is simply setting it as "/videos/.flv" instead of say "/videos/mario.flv"
VIEWS ON THIS POST

50

Posted on:

Friday 28th December 2012
View Replies!

Tab position problem after refresh - JavaScript Help

Hi .. sorry if I wrong placed the topic. I'm not sure is it under HTML or JS.I have problem with my tab position after refresh my page.Here is JSfunction checkAvaib(){ var x=document.getElementById("form"); x.action="student_new.php"; x.target="_self"; x.submit();}Here is HTML
VIEWS ON THIS POST

65

Posted on:

Friday 28th December 2012
View Replies!

How to Degrade a jQuery Navi Bar with Sub Menus Gracefully? - JavaScript Help

I'm wondering what the common practice for this isSimply list all pages at once all together including the sub menusLike this: Link 1 - Link 2 - Link 3 - Link 4Sub1Sub2Sub3etc. Because that's how I have it if I deactivate Javascript in my browser. So should I just leave it like thatI don't really know any other way that would be adequate.
VIEWS ON THIS POST

45

Posted on:

Friday 28th December 2012
View Replies!

Script not working in Firefox - JavaScript Help

HiThis script works well in IE - but not in Firefox, any ideas whyEssentially, it takes (for example) the number of ads times the cost of the add and works out a totalThen it adds together the 4 totals to give a sub totalThen it applies a discount and then tax to give a final totalexample2 * 100 = 2003 * 50 = 150subtotal = 35010% discount = 35vat (17.5%) = 55.13total = 370.13 function reCalcPP() { document.getElementById('credit_pp_total').value = (document.getElementById('credit_pp_num').value * document.getElementById('credit_pp_value').value) } function reCalcPR() { document.getElementById('credit_pr_total').value = (document.getElementById('credit_pr_num').value * document.getElementById('credit_pr_value').value) } function reCalcJobs(){ document.getElementById('credit_jobs_total').value = (document.getElementById('credit_jobs_num').value * document.getElementById('credit_jobs_value').value) } function reCalcEvent() { document.getElementById('credit_event_total').value = (document.getElementById('credit_event_num').value * document.getElementById('credit_event_value').value) } function reCalcTotal() { document.getElementById("subtotal").value = parseInt(document.getElementById("credit_pp_total").value) + parseInt(document.getElementById("credit_pr_total").value) + parseInt(document.getElementById("credit_jobs_total").value) + parseInt(document.getElementById("credit_event_total").value) document.getElementById('total').value = (document.getElementById('subtotal').value - (document.getElementById('subtotal').value * (document.getElementById('discount').value/100))) * (1+(document.getElementById('vat').value/100)) } The other thing, is that it doesn't like empty boxes. Some customers won't buy all 4 of the first 4 fields.Any thoughts on how I can get around thatMany many
VIEWS ON THIS POST

59

Posted on:

Monday 31st December 2012
View Replies!

Why doesn't it change back to green - JavaScript Help

onclick="if (document.getElementById('plus').style.background=='black'){ document.getElementById('plus').style.background='green'; } else { document.getElementById('plus').style.background='black'; }"I click a green button with the ID of plus and it turns black, but I click it again, it doesn't turn back to green
VIEWS ON THIS POST

92

Posted on:

Monday 31st December 2012
View Replies!

Background Doesn't get set... - JavaScript Help

When this code runs, why doesn't it set the background image for the bodydocument.getElementsByTagName('body')[0].style.backgroundImage = '/images/bg2.jpg';
VIEWS ON THIS POST

59

Posted on:

Tuesday 1st January 2013
View Replies!

problem displaying form correctly using thickbox and jqtransform - JavaScript Help

I'm using thickbox to display a pop up with a form that can be submitted. The form itself is using the jqtransform plug to enhance the form fields. The problem is that when using it with IE (any IE) and FF(any FF) the form fields don't display properly. Part of the textbox is missing but you can still type in, and the select menus don't show any content. Everything works fine on Chrome and Safari, but since IE and FF are the 2 main browsers that users use, i really need to fix that or find a work around. I'm hoping someone here has had this issue and managed to resolved it.
VIEWS ON THIS POST

79

Posted on:

Tuesday 1st January 2013
View Replies!

Simple Q - JavaScript Help

I think i sound stupid asking this but i want a input box id to be a javascript variable and text that i write in. var id = 'interior'; Idk if you will understand this , I think you want PHP, not Javascript. You're trying to set it based on a variable during the page load, which Javascript can't do. You could change it after the page loads, but that's completely pointless. You can just set it correctly the first time.
VIEWS ON THIS POST

46

Posted on:

Tuesday 1st January 2013
View Replies!

please help with captcha refresh ... - JavaScript Help

hello , i have a cms i am working on, and when registering a new account, i have a captcha, when you click on the captcha, it should:a. refresh the image to generate a new code.b. empty the security code value.c. focus on the security code.i had this working about 2 days ago, but my friend just tried to create an account, and pointed out that the image does not fresh now ... please take a look at my page and see if i messed something up in the javascript
VIEWS ON THIS POST

47

Posted on:

Wednesday 2nd January 2013
View Replies!

Replace text html onload - beginner level - JavaScript Help

I want to change a web page by nesting extra div tags inside a div which is contained in my html - so that I can format subsections.I don't want to do this with an onclick button, but as the page loads .I'm a beginner at javascript and am struggling with the syntax, so would really appreciate any help.This is an example of what I want to do. Change this: Apple Banana Coconut Chair Lamp Table To this: FRUIT Apple Banana Coconut FURNITURE Chair Lamp Table The actual list is much longer, with about 6 different subcategories, so I expect to be using the first and last items of each subcategory (ie Apple/Coconut and Chair/Table) to identify the start and end point of each find and replace.If someone can just show me the mechanism of find and replace and adding the new html to the document automatically, I can probably fill in the details. the examples I've seen so far use buttons, or either change the tag or the text but not both. I also need to know where to place the code.Many
VIEWS ON THIS POST

50

Posted on:

Wednesday 2nd January 2013
View Replies!

Load file to array. 1 line per value. - JavaScript Help

I have a local text file with several lines of json data. (Each line is different).Is there any way to load this file into a varThat way I can decode each set of json like var[0], var[1] etc.The json data in the text file is updated every minute by a python script.
VIEWS ON THIS POST

87

Posted on:

Wednesday 2nd January 2013
View Replies!

PHP to Javascript - JavaScript Help

I want to use javascript to check the "username" field in my registration form to see if the username already exists in the database, WITHOUT refreshing the page.I was wondering if this is at all possibleHere's the php code I have for it now...
VIEWS ON THIS POST

63

Posted on:

Wednesday 2nd January 2013
View Replies!

Java script working in IE but not in Firefox. - JavaScript Help

I have a sample code in which validation is done by java script.. working fine in IE but not working in firefox. Please suggest. code below
VIEWS ON THIS POST

57

Posted on:

Wednesday 2nd January 2013
View Replies!

update fields - JavaScript Help

i have some javascript which should show the messages at the side of the input but they arent and i dont know where im going wrong. $(document).ready(function() { $("#fullname").blur(function() { //remove all the class add the messagebox classes and start fading $("#msgbox1").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow"); $.post("update.php",{ fullname:$(this).val() } ,function(data) { if (data==1) { $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Update Successful').addClass('messageboxerror').fadeTo(900,1); }); } else { $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox { //add message and change the class of the box and start fading $(this).html('Error Updating').addClass('messageboxerror').fadeTo(900,1); }); } }); }); });
VIEWS ON THIS POST

82

Posted on:

Wednesday 2nd January 2013
View Replies!

2 problems, why won't alert box work and why won't image change? - JavaScript Help

function toggleBg(plus) { if (document.getElementById(plus).style.background=="url('/images/plus.png')"{ document.getElementById(plus).style.background="url('/images/minus.png')"; }else{ document.getElementById(plus).style.background="url('/images/plus.png')"; } } alert("This is a test alert message"); I wanted to change the image of a button when it is clicked from a plus to a minus and then back to a minus. The problem is, it won't change when clicked and if I put minus in the the else bit, it changes to a minus. "url('/images/plus.png')" doesn't seem to match the actual property, so I wanted to get a printout of the actual property using an alert box. But the alert box won't even work when it is in the presence of that function. If I delete the function from the script area, the alert box works. Why doesn't the alert box work in the script above
VIEWS ON THIS POST

200

Posted on:

Wednesday 2nd January 2013
View Replies!

Submit form in Greasemonkey - JavaScript Help

I am making a greasemokey script that gets information from the current webpage, creates an invisible form and submits it automattically. The problem I am running into is getting the form to submit. I get an error saying that submitForm does not exist. I did some searching around and could not find much other than the default submit function does not work with greasemonkey. does anyone know how to acheive this
VIEWS ON THIS POST

81

Posted on:

Wednesday 2nd January 2013
View Replies!