JavaScript - Video Not Playing- Object Does Not Support This Method Of Property
Hello
I am in need of help desperatley. I am trying to get a video to launch from my homepage. see test homepage here http://www.nuviewinc.com/index3.html the video should pop up and play. Like it does here- http://www.nuviewinc.com/testv.html But it doesnt... can anyone help this poor marketing manager with coding? I simply followed the directions here http://www.vmatrixonline.com/vplayer...structions.pdf. all the code appears correct. Similar TutorialsMy website is working perfectly on Firefox but when I visit it with IE(7), I get the following errors and some things aren't where they're supposed to be. Quote: Webpage Script Errors User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618) Timestamp: Fri, 25 Sep 2009 08:31:56 UTC Message: Object doesn't support this property or method Line: 8 Char: 186 Code: 0 URI: http://icarwakim.com/media/system/js/mootools.js Message: Object doesn't support this property or method Line: 59 Char: 102 Code: 0 URI: http://icarwakim.com/media/system/js/mootools.js Website: http://www.icarwakim.com Any advise? I'm Sunita. I am working in ASP .net . I have created Class1.dll file . and in javascript I am creating ActiveXobject . when i debug the application . Its gives error like Object doesn't support this property or method. my code is Code: Class1.cs using System; using System.Collections.Generic; using System.Text; using System.IO.Ports; namespace Ana7140 { public class Class1 { //Declare Variables string data = ""; string log = ""; bool DoneDataReceived = false; bool tare = false; private SerialPort comport = new SerialPort(); public void send() { //Send comport comport.Write("?1"); if (data.Length > 1) { data = data.Replace('\r', ' '); char sign = data[1]; string DelimeterStr = "+-"; char[] delimiter = DelimeterStr.ToCharArray(); string[] splited = null; splited = data.Split(delimiter); data = Convert.ToString(sign) + Convert.ToString(Convert.ToDouble(splited[1])); } else { data = ""; } } public string GetValue() { //Send command to port if (comport.IsOpen) { if (tare == true) { comport.Write("?1"); log = log + "Sent ?1 command"; //if (data.Length > 1) //{ // data = data.Replace('\r', ' '); // char sign = data[1]; // string DelimeterStr = "+-"; // char[] delimiter = DelimeterStr.ToCharArray(); // string[] splited = null; // splited = data.Split(delimiter); // data = Convert.ToString(sign) + Convert.ToString(Convert.ToDouble(splited[1])); //} //else //{ // data = ""; //} while (true) { if (DoneDataReceived == true) { DoneDataReceived = false; break; } } tare = false; }//end of if(tare==true) else { data = "-2"; } } else { data = "-1"; } //This will return the data only return data; } //To fetch the data from Serial Port public void port_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { if (comport.IsOpen) { //Reading Data from Serial Port data = comport.ReadLine();//.ReadExisting(); log += data; // GetValue(); if (data.Length > 1) { data = data.Replace('\r', ' '); char sign = data[1]; string DelimeterStr = "+-"; char[] delimiter = DelimeterStr.ToCharArray(); string[] splited = null; splited = data.Split(delimiter); data = Convert.ToString(sign) + Convert.ToString(Convert.ToDouble(splited[1])); } else { data = ""; } DoneDataReceived = true; //Done with data processing } } catch (Exception ex) { //MessageBox.Show(ex.Message); } } public string getLog() { return log; } //This Function initialiases the serial port //public void Initialise() //{ // try // { // isInitialise = true; // correct = false; // init = true; // //sending command to serial port for initialization // //comport.Write("*\n"); // } // catch (Exception ex) // { } //} public void Tare() { try { //sending command to serial port for initialization comport.Write("T\n"); tare = true; } catch (Exception ex) { } } //This function opens the comport public void Start() { try { //if previously comport is open the firstly close this connection then open again comport if (comport.IsOpen) { comport.Close(); } else { //set Baudrate value as 300 comport.BaudRate = 300; //to read data in string set Data bits as 8 comport.DataBits = 8; //set stop bits as 1 comport.StopBits = (StopBits)1; //set parity bit as None comport.Parity = (Parity)Enum.Parse(typeof(Parity), "None"); //Set Port Name as COM1 //comport.PortName = "COM1"; //Set Read Time Out as 100 comport.ReadTimeout = 100; //Open comport comport.Open(); //Call event for serial data received comport.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived); //data = ""; // comport.Write("?1"); } } catch (Exception ex) { } } //close the connection and close the comport public void Stop() { try { //check whether comport is open or not //if comport is open then close the comport if (comport.IsOpen) { //comport.ReadExisting(); comport.Close(); } } catch (Exception ex) { } }//End of Stop //To check Connection is Opened or not public string getStart() { string check = ""; try { if (comport.IsOpen) { check = "0"; //If the connection is opened,then check=0 } else { check = "-1"; //If the connection is closed,then check=-1 } }//End of try catch (Exception ex) { } return check; }//End of getStart } } JavaScript program is <!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><title> Untitled Page </title> <script language="javascript"> var wshell; wshell=new ActiveXObject("Ana7140.Class1"); function GetVal() { var val= wshell.GetValue(); alert(val); } function setip() { wshell.Start(); wshell.Initialise(); alert(val); } function Stop() { wshell.Stop(); //alert(val); // wshell.Stop(); //alert(val); } function Tares() { wshell.Tares(); //alert(val); // wshell.Stop(); //alert(val); } </script> </head> <body> <form name="form1" method="post" id="form2"> <div> <a href="#" onclick="javascript:setip()"> Connect </a> <a href="#" onclick="javascript:GetVal()"> Acquire Weight </a> <a href="#" onclick="javascript:Stop()"> Disconnect </a> <a href="#" onclick="javascript:Tares()"> Tares </a> </div> </form> </body> </html> plz help me Hi All, Need some urgent. We are having a javascript which is throwing the foll error "Object doesn't support this property or method". The javascript function being called is using a Scanner API. So this is using some ActiveX. Below is the code for javascript <script language="javascript"> // Initialize scanning function OnLoad() { try { Scanner.OpenScanner(); // Scanner.ScanPriority = 0; // Set scanner to Foreground Read mode before enable scanning // Scanner.EnableScanning(1); document.forms["mobileform"]["rm07m-bwartwe[1]"].value = "101"; } catch (e) { alert(e.message); } } // Clean up function OnUnload() { Scanner.CloseScanner(); // Calling Dispose is necessary for Pocket IE because of a Microsoft issue related to releasing object. if (navigator.appName == "Microsoft Pocket Internet Explorer") Scanner.Dispose(); } // Scan through soft trigger function Scan() { try { Scanner.SetSoftTrigger(1); } catch (e) { alert(e.message); } } //User-defined function to format error codes. //VBScript has a Hex() function but JScript does not. function hex(nmb) { if (nmb > 0) return nmb.toString(16); else return (nmb + 0x100000000).toString(16); } </script> There is a object tag in html <object id="Scanner"></object> The javascript functions are called from body tag. Can someone please provide some help. Thanks, Nikhil Hi, When I try and geocode an addres to my google map I receive the error: Object does not support this method or property I have gone over the script and can't work out what I did wrong. Code: <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html {height:250px} body {height:250px} #bookmark_map {width:90%; height:250px; margin-left:15px;} </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" /> </script> <script type="text/javascript"> var geocoder; var map; function createGMapFromAddress(){ geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(0,0); var map_options = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("bookmark_map"), map_options); } function loadBookMarkMap(location){ alert(location); var address = location; alert(address); geocoder.geocode({address: address}, function(results, status){ if (status == google.maps.GeocoderStatus.OK && results.length){ if (status != google.maps.GeocoderStatus.ZERO_RESULTS){ map.set_center(results[0].geometry.location); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: map }); } } else { alert("Geocode was unsuccessful due to: " + status); } }); alert(marker); } </script> </head> <body onload="createGMapFromAddress()"> //php get from table $possumshaw ="{$row['address']}"; } echo '<input type="button" class="button4" value="View Map" onclick="loadBookMarkMap(\'' . $possumshaw . '\')" />'; ?> I found strange for the following code: Code: var allextRules = Ext.util.CSS.getRules(); Object.keys(allextRules).forEach(function(key) { var keyname = key; if(keyname.indexOf("js") != -1){ Ext.util.CSS.removeStyleSheet(keyname); console.log(keyname + " Removed"); } }); When the above work is tested in other browser (say - Google Chrome), there is no error. However, when tested in IE 9, there is error as follows: Code: SCRIPT438: Object doesn't support property or method 'keys' According to this article (https://developer.mozilla.org/en/Jav...ts/Object/keys), the Object.keys is supported by IE. Have I miss out something? for (var i=0; i < document.myform.registrationtype.length; i++) { if (document.myform.registrationtype[i].checked) { var registrationtype = document.myform.registrationtype[i].value; } } what is wrong with this? i'm trying to get the value of registrationtype (a radio box) i'm getting an error object doesn't support this propery or method Hello just a quick problem with a seemingly difficult solution that I'm not aware throughout. What I'm attempting to do is increment a value when the mouse hovers over the element by using this move_right function: Code: function Move_Right( event, element, number) { number++; var elem = document.getElementById(element); elem.style.right = number + "px"; } inside the mouseover event trigger function which I figured out. The problem is it doesn't move incrementally only once every mouse hover no matter the technique of setInterval(); and or setTimeout(); also ontop of this problem I'm getting errors like : 2014-10-12 20:07:57.785Uncaught TypeError: Cannot read property 'style' of null even after the changes I made also after this original function call : This is the current code so far which is different to the previous code above "obviously" : Edit fiddle - JSFiddle Thanks if someone knows the issues here, I hope it makes sense . hi I am trying to play a video from youtube. What I have done so far is getting videos from my database and displaying all those videos thumbnails. So now what i want is to when i click any thumbnail it should play that video in my website. How can I do this? Here is my code Code: function showResult(result) { $('#videosLoader').css('display','none'); var videoId = result.split(" "); for(i = 0; i < videoId.length - 1; i++) { var vidId = $.trim(videoId[i]); vidLink = getScreen(vidId,"small"); $('#videosList').append("<div class='playVid'>" + "<img width=80 height=80 src=" + vidLink + " alt='' /> " + "<input type='hidden' name='vidId' value='" + vidId + "' />" + "</div>").addClass("playVid"); } $('.playVid').click(function() { var val = $("input[name='vidId']").val(); alert("val"); $("#haveYourDefinition").append("<embed src='http://www.youtube.com/v/" + val + "&rel=1' pluginspage='http://adobe.com/go/getflashplayer' type='application/x-shockwave-flash' quality='high' width='450' height='376' bgcolor='#ffffff' loop='false'></embed>"); }); When I click any thumbnail it does nothing. Why and please tell me how to do this? Help Hey Guys, I've been working on a WP site that uses a handful of plugins - several of which include java-script files. I've been having trouble with one of the plugins and have started the debugging process and noticed that the page the problem is occurring on shows a few java-script errors. http://proshotsrange.com/test-contact-page/ What do the "Object Not Supported" errors mean - and what would it entail to fix them? Thanks in advance. Code: Webpage Error Details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0) Timestamp: Mon, 22 Nov 2010 16:43:02 UTC Message: Object doesn't support this property or method Line: 143 Char: 2 Code: 0 URI: http://proshotsrange.com/wp-content/plugins/wp-e-commerce/js/wp-e-commerce.js?ver=3.7.58 Message: Object doesn't support this property or method Line: 4621 Char: 7 Code: 0 URI: http://proshotsrange.com/wp-includes/js/prototype.js?ver=1.6.1 Message: 'style' is null or not an object Line: 33 Char: 6 Code: 0 URI: http://proshotsrange.com/wp-content/plugins/lightbox-2/lightbox.js?ver=1.8 I have looked at the various posts about setting onclick in IE and I cannot see any that exactly describe the problem I am having. Firstly I am not trying to set onclick by calling setAttribute, which most of the posts describe. I am simply assigning a value to the onclick attribute of the element, which those posts seem to imply. Specifically I am getting "Object doesn't support this action" on the following line: Code: editButton.onclick = editCitation; editCitation is already a function, so I do not see why I should have to wrap it in an anonymous function wrapper to get IE to permit the assignment. Hey, this error ONLY occurs in IE. "Unexpected call to method or property access." I pinpointed it to this line: o.appendChild(e); The full function is: Code: function aO(d, t, src, p, id ){ alert('aO has begun.'); var o, e, i; if (!ie){ o = cE('object');o.data = src; } else { o = cE('embed');o.src = src; } o.id = id; if (!ie){ p.push( ['movie', src] ); } if ( typeof(id) === 'String' ){o.id = id;} o.type = t; o.style.width = '210px'; for(i = 0; i < p.length; i++){ e = cE('param'); e.name = p[i][0]; e.value = p[i][1]; o.appendChild(e); } d.appendChild(o); alert('aO has finished.'); } What it does is write a flash object to the page. The FULL code is: Code: <!-- Chat Options --> <noscript> It appears that you do not have JavaScript enabled. Please enable it, otherwise you cannot view the chatbox. </noscript> <div id="chatWrap"> <ul id="ccon" style="display:none;"> <li><a href="javascript:void(0);" onclick="switchChat();">Switch to <span id="cnext">Chat Title</span></a></li> <li><a href="javascript:void(0);" onclick="resizeChat();"><span id="csize">Expand</span> Chat</a></li> <li><a href="javascript:void(0);" onclick="toggleChat();"><span id="chatToggle">Close</span> Chat</a></li> </ul> </div> <div id="cbox" style="display:block;"></div> <!-- Chat Script --> <script type="text/javascript"><!-- // --><![CDATA[ var chats = []; chats[0] = ['Main Chat', 'Uber-Anime-Chat', 1236404792847]; chats[1] = ['Roleplay Chat','Uber-Anime-Roleplay', 1236403501064]; var chat = { 'opt': 'a=000000&b=100&c=999999&d=848484&e=000000&g=CCCCCC&h=333333&i=29&j=CCCCCC&k=666666&l=333333&m=000000&n=CCCCCC&s=1&t=0', 'ref': 'www.uber-anime.com', 'cur': 0, 'delay': 1.5, 'params': [['wmode','transparent'] , ['allowscriptaccess','always'] , ['allownetworking','internal']] } var chatState = 0; var chatStates = []; chatStates[0] = ['Expand', '300px']; chatStates[1] = ['Shrink', '500px']; function cE(e){return document.createElement(e);} function cT(s){return document.createTextNode(s);} var ie = false; function aO(d, t, src, p, id ){ var o, e, i, embed; if (!ie){ o = cE('object');o.data = src; } else { o = cE('embed');o.src = src; } o.id = id; if (!ie){ p.push( ['movie', src] ); } if ( typeof(id) === 'String' ){o.id = id;} o.type = t; o.style.width = '210px'; for(i = 0; i < p.length; i++){ e = cE('param'); e.name = p[i][0]; e.value = p[i][1]; o.appendChild(e); if(ie) { embed = cE('embed'); embed.setAttribute(p[i][0], p[i][1]); } } if(ie) o.appendChild(embed); d.appendChild(o); } function switchChat() { if (document.getElementById('cbox').hasChildNodes()) while (document.getElementById('cbox').childNodes.length >= 1) document.getElementById('cbox').removeChild(document.getElementById('cbox').firstChild); var x = chat.cur; chat.cur = (x + 1) % chats.length; var c = chats[x]; var src = 'http://st.chatango.com/flash/group.swf?ref=' + chat.ref + '&gn=' + c[1] + '.chatango.com&cid=' + c[2] + '&' + chat.opt; document.getElementById('cbox').innerHTML = ''; aO( document.getElementById('cbox'), 'application/x-shockwave-flash', src, chat.params, 'chat' ); document.getElementById('ccon').style.display = 'block'; // qfix document.getElementById('cnext').innerHTML = chats[chat.cur][0]; document.getElementById('chat').style.height = chatStates[chatState][1]; document.getElementById('csize').innerHTML = chatStates[chatState][0]; } function resizeChat(){ if(chatState == 0) chatState = 1; else chatState = 0; document.getElementById('chat').style.height = chatStates[chatState][1]; document.getElementById('csize').innerHTML = chatStates[chatState][0]; } function toggleChat() { if(document.getElementById('cbox').style.display == 'block') { display = 'none'; chatStateTxt = 'Open'; } else { display = 'block'; chatStateTxt = 'Close'; } document.getElementById('chatToggle').innerHTML = chatStateTxt; document.getElementById('cbox').style.display = display; } function chatInit(){ if (navigator.userAgent.indexOf('MSIE') !== -1){ie = true;} if ( chat.delay <= 0 ){ switchChat(); } else { i = cE('img'); i.src = 'ajax-loader.gif'; document.getElementById('cbox').appendChild(i); document.getElementById('cbox').appendChild(cT(' Loading Chat... If this message stays up, your browser may not be supported.')); var clk = setTimeout( function(){ switchChat(); }, chat.delay * 1000 ); } delete chatInit; } chatInit(); //]]> </script> Can anyone tell me how to fix this? This is ridiculously irritating, and it's important that I can fix it ASAP. Hi, I'm a newbie to the forum and jquery and have been trying to use it for a slick form wizard i found here. http://thecodemine.org/ It's almost complete but IE keeps giving me an error I've tried everything to fix with no luck. I'm using jquery-1.4.2.min.js and the error it's giving me is Unexpected call to method or property access. line 103 character 460 The code it highlights is: Code: {this.nodeType===1&&this.appendChild(a)})}, at the end of this line. Complete line is: Code: wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, Any help would be greatly appreciated. Thanks! FYI: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Tue, 15 Nov 2011 16:45:53 UTC Message: Unexpected call to method or property access. Line: 103 Char: 460 Code: 0 URI: http://custsatdev/contact/jqueryform...y-1.4.2.min.js I am and seem to remain newbie ... I have a JS script that presents a series of "pages" with different questions inside a single HTML file, by rewriting certain <div>s. I have an object like this that contains the questions and information about answer labels etc (the idea is that this should be easy to modify for someone who doesn't know JS): Code: var Questions = [ { "question" : "How good is this?", "labels" : ["excellent","very good","good","bad","very bad","awful"], "page" : 0 , "random" : false , "type" : "default", "varname" : "allgood" }, { "question" : Change[curCase]+"What do you think now?", "labels" : BetterLabels, "page" : 1 , "random" : true , "type" : "default", "varname" : "betteradapt" } ] This object is initialized when the page loads, and a function reads the total number of pages by getting the maximum number of the "page" property across elements. Later, the object is accessed by thenextQuestion() function which uses the "page" property to looks whether each element belongs on the current page , then reads out the properties and presents the question. This works okay. Now the tricky bit: For some questions, their text should be different depending on which case is currently on the screen (Change[curCase]). curCase is different on each page, an integer between 0 and Change.length. I cannot get this to work for the Questions object, probably because the Questions object has been already initialized when the page loaded. How can I get my function nextQuestion() to "re-evaluate" the property "question" for all the elements of the Questions objectwhen nextQuestion() is called , using the current value of "curCase"? nextQuestion() is longer, but the (i think!) crucial bits are he Look whether question belongs on current page and push it onto new array: Code: for (i=0; i < Questions.length; i++) { Questions[i].page = Questions[i].page; if ( Questions[i].page == BlockNum ) { // if the q belongs on the current page QuestionsObjectThisPage.push(Questions[i]); } } Then, extract an array containing the questions, which will then be presented: Code: for (i=0; i < QuestionsObjectThisPage.length; i++) { QuestionsThisPage.push(QuestionsObjectThisPage[i].question) ; } So what I'm looking for is something to change either of these two Object.push() functions so they don't simply take the value they find in the Questions (or QuestionsThisPage) object, but to re-evaluate the code for the "questions" property, taking into account the current value of curCase Phew. I found that really hard to describe; hope it's somewhat clear. Hello, how can I make the following object work properly so when I use 'layers.photo1.layer' a jQuery element is returned rather than the text of the function as it is now. I also need to be able to find the element by the photo1 object its contained in not have to input a string there so that I can also reuse it in the background layer. Code: var layers = { photo1 : { layer: function() { return $(element).find($('photo1'))} }, background : { layer: function() { return $(element).find($('background'))} } } Thx Very Much! I'm using closure to make a function return an object in the form of the literal. Code: function myFunction() { return { a : 'foo', b : 'bar', c : 'baz', d : this.a } } I'd want the d property to be equal to "foo". However, when I do that, "this" is tied to the global namespace as opposed to the object. Any ideas? Julian Hello, I was able to solve an issue I had in previous post in writing some code to grab a section of a cookie value string (2 letter state ex MD) and check against it to do something. That was easy because the state was at the end of the string and all I had to do was use the slice() method. Now I was to be able to grab the 2 letter state from a string that looks like this: BALTIMORE, MD|blah blah|blah blah|blah blah (the real cookie value string will always be separated with pipes (|)) Can anyone please help? Thanks in advance! Code: <HTML> <HEAD> <TITLE></TITLE> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <SCRIPT LANUAGE="JavaScript"> function setCookie(name, value, expires, path, domain, secure) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } </SCRIPT> </HEAD> <BODY> <script> $(function(){ $('div').each(function(){ if($(this).hasClass('stateSelect1')){ if (getCookie("location")!=null){ var state = getCookie("location").slice(-2).toLowerCase(); var stateArray = []; stateArray = $(this).attr('rel').toLowerCase().split(','); if($.inArray(state,stateArray) >= 0){ $(document).ready(function(){ $(".stateSelect0").css("display","none"); $(".stateSelect1").css("display","block"); }); } } } }); }); </script> <strong>Step 1. Copy and paste in cookie set text field:</strong> <br> <br> <strong>Show Image1:</strong><br> CHARLOTTE, NC|blah blah|blah blah|blah blah|blah blah<br> BALTIMORE, MD|blah blah|blah blah|blah blah<br> <br> <strong>Show Image2:</strong><br> COLUMBIA, SC|blah blah|blah blah|blah blah<br> RESTON, VA|blah blah|blah blah|blah blah<br> <br> <strong>Show Image3:</strong><br> LOS ANGELES, CA|blah blah|blah blah|blah blah<br> SEATLE, WA|blah blah|blah blah|blah blah<br> <br> <br> <strong>Step 2.</strong> <input type="button" value="Set Cookie" onclick='setCookie("location", prompt("Enter your location"))' /> <br> <br> <strong>Step 3.</strong> Now refresh page. <br> <br> <style> .default{ border:3px solid limegreen; margin-bottom:5px; width:200px} .div1{ border:3px solid red; margin-bottom:5px; width:200px} .div2 { border:3px solid purple; margin-bottom:5px; width:200px} .div3 { border:3px solid yellow; margin-bottom:5px; width:200px} .div4 { border:3px solid blue; margin-bottom:5px; width:200px} </style> <!--DEFAULT IMAGE IF NO COOKIE SET OR NON LISTED STATE--> <div class="stateSelect0 default"> DEFAULT IMAGE </div> <!--DEFAULT IMAGE IF NO COOKIE SET OR NON LISTED STATE--> <div class="stateSelect1 div1" rel="NC,MD" style="display:none">Image 1 - DIV 1</div> <div class="stateSelect2 div2" rel="SC,VA" style="display:none">Image 2 - DIV 2</div> <div class="stateSelect3 div3" rel="WA,CA" style="display:none">Image 3 - DIV 3</div> </BODY> </HTML> I could not figure out the answer, and could not find the answer from Google. I have following object PHP Code: ; var obj = function() { ; this.method_1 = function() { ; return this.method_2 } ; this.method_2 = function() { ; return 'my parameter' } } It works. If I want method_2 having parameter, I write it this way: PHP Code: ; var obj = function() { ; this.method_1 = function() { ; return this.method_2 } ; this.method_2 = function(para) { ; return para } } ; var newObj = new obj() ; window.alert(newObj.method_2('my parameter')) It works and returns "my parameter". If I want method_2's parameter to be assigned by method_1, I write it this way: PHP Code: ; var obj = function() { ; this.method_1 = function() { ; return this.method_2('my parameter') } ; this.method_2 = function(para) { ; return para } } It does not work. So, the question is how to assign a parameter of a method by another method? Thanks a lot. I do not really understand what is happening to my code but it just tell me the following: Code: document.getElementById("#movingword") is null How could the movingword be null when I have declared it in my code? The following is my code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="language" content="english"> <meta http-equiv="Content-Style-Type" content="text/css"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <title></title> <style type="text/css"> body { background-color:#000; } #scenery { position:relative; } #moving { position:absolute; float:right; top:100px; left:50px; } #movingword { position:absolute; float:right; top:0px; left:0px; } </style> <script type="text/javascript"> var a=120; $(document).ready(function() { document.getElementById("#movingword").style.top = a + "px"; }); </script> </head> <body> <font color=white><h1> Hello World </h1></font> <div id="scenery"> <img src="http://www.deshow.net/d/file/travel/2009-10/new-zealand-scenery-738-20.jpg" alt=""> <div id="moving"> <img src="http://maadinfo.com/images/blinking.gif" alt=""> </div> <div id="movingword"> <font color="yellow"><font size="3"><b>This is the place</b></font><br>Welcome!</font> </div> </div> </body> </html> function get_price() { var the_price=1000; if (this.speed=="500MGz") the_price+=200; else the_price+=100; if (this.hdspace=="15GB") the_price+=50; else the_price+=25; if (this.ram=="128MB") the_price+=150; else the_price+=75; return the_price; } function computer(speed,hdspace,ram) { this.speed=speed; this.hdspace=hdspace; this.ram=ram; this.price=get_price; } var work_computer=new computer("2GHz","80GB","1GB"); var home_computer=new computer("1.5GHz","40GB","512MB"); var laptop_computer=new computer("1GHz","20GB","256MB"); var work_computer_price=work_computer.price(); var home_computer_price=home_computer.price(); var laptop_computer=laptop_computer.price(); ___________________________________________________ In the above code, the line I'm having trouble with is marked red. Why is it that when I call the method using ... this.price = get_price; It works fine. But if I assign the object this.price with like this... this.price = get_price(); I get an error? Isn't get_price() a function? So shouldn't the parenthesis be included when the method is called? Why are we suppose to leave out the parenthesis?! I'm confused. Thanks! im using a mootools popup box to play a youtube video its using javascript to control the "close" button.. and the close button uses this function Code: clickClose: function(){ $(this.box).effect('opacity',{ wait:true, duration:this.fadeSpeed, transition:Fx.Transitions.linear }).chain(function(){ }).start(this.opacity,0); this.box.setStyle('display','none'); this.isVisible = false; }, seeing as ow i have a playing video in the box...that simply wasnt enough..because the video would continue playing after the box is closed... (you would ehar audio) so i modified the code by adding Code: this.box.setStyle('display','none'); this did the TRICK!!! ....in firefox.....sadly Internet Explorer is refusing to destroy that video upon click.... are there any ideas as to how i can destroy that video across all browsers when that button is clicked....i say "destroy" because im mad! lol but i simply want the video to dissapear...off the screen and off the site with no mysterious audio afterwards. |