Jump to content

draig_hand

Member
  • Posts

    23
  • Joined

  • Last visited

Everything posted by draig_hand

  1. Resolved it myself by cheating. I've placed the code below fyi. function disableButton() { var tempdur="a duration value from program"; if(myValue=incorrect) document.getElementById('button').disabled = false; else if((myValue=correct) setTimeout("document.getElementById('button').disabled = true;",1)&&setTimeout("document.getElementById('button').disabled = false;",tempdur); }
  2. Hello all, I am trying to figure out a way to enable and disable a button depending on wether a video is in pause (enable) or play (disable) condition. I have tried to figure out if this can be done using only JavaScript coding but with no success. Can it be done with JS or is there a need to use ActionScript in the fla? (I hope not!). Please find the code below fyi. (Note it refers to external video_shell.fla, .flv and .swf files built using Adobe Flash CS3.) Can someone look at the code supplied and point me in the right direction please? Thanks very much. codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="490" height="367" id="video_shell" align="middle"> value="#e5e5e5" /> allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> I need something along the lines of: function enabledisable() { if(video is not playing) { document.getElementById('button').disabled = false; } else if (video is playing) { document.getElementById('button').disabled = true; } }
  3. Succeeded with window.open(choosetopic()+''+chooseproject()+''+".html");
  4. Thanks everyone The solution - i just needed to put quotes around it window.open("disclaimer.html") Thanks again.
  5. Thanks Benjamin I'll give it a go and get back to you. Thanks again.
  6. Hello all, I am trying to set up an onclick function in Javascript that opens another html file. Below there are a few examples of the code used and the error messages they received. Please note that it must be a button not a hyperlink and also it needs to be the genuine file that opens not a popup window. I cannot fathom why a simple request to open a file with a button should be such a problem! Can anyone assist please? THE FOLLOWING CODE function openFile() { file.open(C:\Documents and Settings\Administrator\My Documents\abbtweb\disclaimer.html) } GETS ERROR:- - line 145 Object expected (button line of code) ... THE FOLLOWING CODE function openFile() { file.open(disclaimer.html) } GETS ERROR:- - line 227 file is undefined (file.open line of code) ... THE FOLLOWING CODE function openFile() { file.open{C:\Documents and Settings\Administrator\My Documents\abbtweb\disclaimer.html} } GETS ERRORS:- - line 227 char 11 expected ; (file.open line of code) - line 145 Object expected (button line of code) ... THE FOLLOWING CODE function openFile() { window.open(disclaimer.html/) } GETS ERRORS:- - line 227 'disclaimer' is undefined (window.open line of code) ... THE FOLLOWING CODE function openFile() { window.open(/disclaimer.html/) } GETS ERRORS:- - line 227 Access Denied (window.open line of code)
  7. ElEng GenKno HVAC ICT Engineering MarEng /* end clicking */> Scope Specification Design Build Accept /* end clicking */> LOD 1 LOD 2 LOD 3 LOD 4 /* end clicking */> My FileName Values:
  8. Hello all, I have tried to solve this problem a number of ways, all unsuccessfull, and I am now back at the stage were I have to begin again so I am seeking your help. I have two radio button arrays which I want to use to construct a file name and then have a button 'onclick' command that opens that file. I am finding it difficult writing a function that can retrieve the checked values and retain them until the button 'onclick' event is initiated. FYI The first array provides the first part of the file name, the second array the second part and then the file extension is added to the file name at the 'onclick' event. I am hoping someone can suggest a way of picking up these values, concatentating them and then opening the file? Thanks for taking the time to read this.
  9. Hello Stefan, My reason fro delay in reply to your last post is that I have taken your advice and 'bitten the bullet' and obtained CS3 since which time I have been struggling to learn how to use it all. (it's a very powerfull and comprehensive package!) I have opened a new thread which you may be interested to view - http://www.killersites.com/forums/post/10185/#p10185 Thankyou for taking the time to answer my earlier request.
  10. Hello all, I have an HTML page created using Dreamweaver CS3 which contains a SWF movie produced with Flash CS3 (movie duration 9min57secs). I have deliberately excluded the addition of a skin and the movie is placed in a ?Pause? condition when the page opens. Within the HTML I have a Javascript function which produces a duration value 'x'. (which is an integer of milliseconds) My requirement, and my problem, is that I wish to pass this duration value to the Flash video in such a way as to instruct the video to ?resume? play and then (after 'x' milliseconds duration) pause the playback and await the next ?resume? instruction from Javascript. I am aware that Javascript and Actionscript can pass instructions to and from one another using ?ExternalInterface.addCallback? and ?ExternalInterface.call?, however, all the tutorials and forum examples I have viewed to date only show how to pass text, or to run a very short video to its end and invariably they all involve the use of a button to instigate the function. Can anyone direct me to, or provide, an example that performs the functions I have described above. I hope someone can help me. Thanks.
  11. Hello Stefan, Thanks for your prompt response. I've been reading up on Flash, as you say it's powerfull, unfortunately it's powerfully expensive too. Can you recommend a cheaper alternative that I could use until I'm profficient enough to justify the purchase of Flash? Something that would make the transition to Flash straightforward.
  12. Hello, I wasn't sure that I could choose the appropriate forum for this query so, if anyone can advise me of the correct forum I would appreciate it. Please note that I am deliberatelly not mentioning formats or applications in this query! I wish to have a video on my web page that has no direct user control of Start, Pause, Stop, etc. The video presented needs to be controlled by the background program which at appropriate points will advance or pause the video. Can anyone advise the best video format and best program language to use to accomplish this? In addition would anyone know where I can see an example of this sort of thing in action. Thanks in advance.
  13. I replaced the existing code with the code you supplied. Locally the functionality is unaffected i.e. it works. Unfortunately I'm still seeing the same problems when running from the web server! Observation: (NB - the 'quizform' form contains 'thequestion', 'theresponse' and 'thesolution'.) When rolldice function completes the "theresponse" and the "thesolution" parts of the form are returning the correct details. It is only "thequestion" that does not correspond with the rolldice result! Is it possible that the 'generatequestions' function is to blame? To see on server look for abbermist.co.uk/quizGK%20w3c%20NEWEST.html
  14. Reading the link provided I felt I was nearing the end of the saga too so I copied the suggeted solution:- on action {loaded()} However, try as I might I cannot seem to fit this into my code and make it work I'm sure it's due to my ignorance. e.g. the first line of given code is "on action {loaded()}" - I don't know where this would fit. It seems to be hanging there independant of the rest of the code!? Also the convention
  15. Here it is :- http://www.abbermist.co.uk/quizGK%20w3c%20NEW.html
  16. Hello SharWeb, Unfortunately solution not fine for me. My real sticking point right now is that the quiz which works on my PC does not work when run from a web server! I believe it may be due to the fact that a web server takes more (or less?) time to run the code than my PC and the program is getting itself confused. Putting alerts in and then seeing the program present everything correctly seems to prove that. Does anyone know what I can do to the code that simulates the effect of the alerts? Thanks.
  17. Hello again BeeDev, Back from holiday - seems a long time ago already. I have created a quiz that works on my local PC but when uploded to web server behaves very strangely. (Code at botom of this message) My problem is that from the web server the quiz JS file presented is incorrect and the question presented is from anothjer JS file entirely I placed alerts to indicate wether or not the correct script is being called and the correct question number presented. This works locally of course, but now the strange thing - when on web server the alerts show that the JS file and question are in fact correct! Indeed the quiz can be said to be working as desired if not for the alerts popping up. However when I remove the alerts from the page on the server the page goes back to presenting the wrong JS and question! Why would alerts cause the page to operate correctly and no alerts not? FYI:- I ran the code through the 'W3C Markup Validation Service' and it returned only one error - " Validation Output: 1 Error Line 91, Column 53: Attribute "ID" is not a valid attribute. Did you mean "id"? ?="javascript" src='quizgk/11.js' Id='script1' type="text/javascript">? You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. " I have spent days trying to find another way to identify the script so that my program can call the next script. Can you help?
  18. Thanks very much. You've given me a lot to think about. I will get back to you with my results, but it wont be for about 4 weeks as I'm going on holiday in a couple of days. I appreciate the time and effort that you put into this. All the best.
  19. You seem to have hit on the crux of the matter. The success of what I am trying to do revolves around my being able to have the program change the Q&A JS file it refers to whenever a dice roll is completed. That is what - document.scripts('script1').src='quizpm/'+d1+''+d2+'.js'; is supposed to do. That is to change the "11" in It was the only solution I could find and until now was completely satisfied with it. Unfortunately I think its shortcomings are being shown up when placed on the server. Would you know how to change this into a function? Thanks for pointing out the javascript debuggers' (apropriate surname that ). I looked at the IE developer debugger I already have and found I couldn''t understand what it was trying to do for me, or if indeed it was working at all. I'll look into Firebug next. Thanks for taking the time to help me.
  20. Hello BeeDev, Hope I can explain what I'm seeing clearly enough. The HTML code is below this message. A copy of the contents of one of the JS files is at the bottom. Following the first ever roll of the dice the result (d1 and d2) identify the Javascript file that will provide the Q&A by modifying " " (i.e. changing the "11" to whatever d1,d2 result is). This works well locally. I can view the result of dice roll and confirm q&a are coming from the required JS file. When uploaded however the first roll dice result is ignored and the question is derived from "11.js". The program/script seems to be looking back to the previous roll result and not at the current role result. I have tried to tidy up my code a bit and have input notes to help me navigate through it, so hopefully it won't be too much of a mire for you to wade through. Thanks for your help. > br />"http://www.w3.org/TR/html4/loose.dtd"> Project Management Quiz </pre> <table width="74%" border="0"> The Training Game A game for aspiring and experienced trade and professional personnel - and the insatiably curious. By Abbermist Limited. Programme Office Specialists. Established 08/11/1985 Choose: ---- a b c d Answer: Correct: Incorrect: Success Rate: Cheat Mode Choose a Topic Project Management General Knowledge Electrical Mechanical Marine HVAC other Choose a Project House Personal Computer Rocket Aircraft Oil Rig Ship GAME SCOPE Your objective is to complete the project in as few rolls as possible. Left die determines the subject, right die determines the level of difficulty. From Level 1 (Easy) to Level 6 (Hard) , successfully answering the question presented will move the build on a proportionate amount. map history copyright mission guest site us overcome prepare plan cost doc change issue risk POF Project Progress Visitor number Questions set by: ABBERMIST Game area graphics by: PJP Program by: PJP MORE GAMES Copyright Abbermist Limted 2009 </table> <br><table width="73%" border="1"> YOUR LOGO HEREYOUR LOGO HEREYOUR LOGO HEREYOUR LOGO HEREYOUR LOGO HEREYOUR LOGO HEREYOUR LOGO HERE</table> <br><br><br><br><br><br><br JAVASCRIPT FILE quizpm/11.js contents var total=5 var question=new Array() for (i=1;i<=total+1;i++){ temp="choice"+i+"=new Array()" eval(temp) } var solution=new Array() /*QUIZPM 11 Below lists the questions, its choices, and finally, the solution to each question. */ question[1]="Which of the following statements is NOT TRUE about the text within a Plan?" choice1[1]="Words are useful as well as pictures." choice1[2]="A Plan is not complete without explanatory text and justification." choice1[3]="Constraints within the Plan should be documented." choice1[4]="Narrative text is always waffle." question[2]="Which of the following should not be part of the Project Plan?" choice2[1]="The resources and time needed for all relevant activities (including project management and control) and any need for people with specific skills." choice2[2]="When activities will occur." choice2[3]="Agreed tolerances." choice2[4]="Risk Log." question[3]="The document that captures the why, what, where, when, how, how much and who for the project is called:" choice3[1]="Project schedule." choice3[2]="Project definition and delivery report." choice3[3]="End of feasibility report." choice3[4]="Project management plan." question[4]="Which of these processes does NOT trigger the Planning (PL) process?" choice4[1]="Starting Up a Project (SU)." choice4[2]="Initiating a Project (IP)." choice4[3]="Managing Stage Boundaries (SB)." choice4[4]="Directing a Project (DP)." question[5]="Which of the following is not used in the quality control process?" choice5[1]="Gantt charts." choice5[2]="Control charts." choice5[3]="Pareto charts." choice5[4]="Statistical sampling." solution[1]="d" solution[2]="d" solution[3]="d" solution[4]="d" solution[5]="a"
  21. Hello again all. I have a page which has javascript driving image changes and retrieving data from JS files. The page was created using Dreamweaver. The functionality when tested on my local site (desktop pc) works fine but when uploaded it behaves differently. Has anyone experienced this sort of thing before and know why it is happening? I can post the code later if anyone thinks it's because of the way my code is written. Thanks
  22. Thankyou BeeDev, You've given me a lot to think about. I've only recently started working with JS and am finding it a bit of a struggle not having a background in programming. Your detailed explanation is very helpful - I'll be using that link today. To answer your questions, finding where Correct and Incorrect comes from is proving difficult. That is to say it seems that the outputs that generate the 'correct' and 'incorrect' messages cannot also be used to increment a running total. (probably my ineptitude tho) I've posted my code below so you can see what I mean: function responses(){ var temp2=document.instantquiz.theresponse var temp3=temp2.options[temp2.selectedIndex].text if (temp3!=solution[dq]&&temp2.selectedIndex!=0) document.instantquiz.thesolution.value="The correct answer is "+solution[dq] else if(temp2.selectedIndex!=0) document.instantquiz.thesolution.value=("CORRECT") This is where I am at the moment (please don't laugh). Percentage Success Rate: Cheat Mode Oh, go on then, LoL I'll let you know how I get on. Thanks again. Regards.
  23. Hello, I have a multiple choice quiz in HTML. My requirement for scoring this quiz seems to be different from every other quiz I have seen on the WWW. This is due mainly, I believe, to the fact that the number of questions involved in this quiz can be from 1 to infinite as the user action brings up the next question from external JS Q&A files. In addition I want the user to see their score amended each time they answer a question, not at the end of the quiz (which theoretically may never happen). In the existing code I already determine and provide "Correct" and "Incorrect" messages immediately following the selection of any of the four 'answer' radio buttons. What I need to do now is to find out how I can arrange to: 1 count all the ?Correct? answers - when they occur and add to a 'running' total (RT1) 2 count all the ?Incorrect? answers - when they occur and add to a 'running' total (RT2) 3 calculate:- (RT1/(RT1 + RT2)) x (100/1) = percentage success rate so far. The ?percentage success rate so far? is to be shown in a text field for the user to see. Can anyone advise me what is involved in this and how I should approach it? Pointing me towards an example, if one exists, would be very helpfull. Thanks.
×
×
  • Create New...