Jump to content

maxwel

Members
  • Posts

    47
  • Joined

  • Last visited

Posts posted by maxwel

  1. The problem is that onclick just call the last fucntion which is button2() also tried to do it like onclick"button1(); button2();" but it do the same thing. been trying lots of ways like onsubmit but still dont work. idk why is that?



    <script type='text/javascript'>
    function submitnow(){
    function OnButton1()
    {
    document.forms['form1'].action='somefile';
    document.forms['form1'].target='_blank'; // Open in a new window

    document.forms['form1'].submit(); // Submit the page
    return true;


    }
    function OnButton2()
    {
    document.forms['form1'].action='somefile';
    document.forms['form1'].target='_self'; // Open in a new window

    document.forms['form1'].submit(); // Submit the page

    return true;
    }
    }
    </script>
    </head>
    <body>
    <input type='hidden' name='submitted' id='submitted' value='1'/>
    <form enctype="multipart/form-data" method="post" id="form1" name="form1" action="somefile">
    <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="<?php echo $up_id; ?>"/>
    <input type="file" name="fileToUpload" size="40" onclick="toggle_visibility('progress_win');" id="file"/><br />
    <iframe id="upload_frame" name="upload_frame" frameborder="0" border="0" src="" scrolling="no" scrollbar="no" > </iframe>
    <br />
    <input type="submit" name="Submit" value="Upload Mix" onclick="submitnow()" /><br>

    can even someone write something similar to do it with ajax instead of js? cuz through searching i found that it seems to be done through ajax than js


    -simply i need to submit this form to 2 targets for 2 actions but it doesn't work it just submit to last function and ignore the first


  2. been searching heavily but none :/ idk is it me only who facing such prob?! LS btw i want to learn more javascript and jquery especially through the net is there a good and free/cheap way for doing  that? also i got a problem with jplayer thingy u mind  posting it up here in that thread?

     

    Thanks for all ur help and support,

    Maxwel

  3. thought it was solved but unfortunately it wasnt, it actually now move but to the wrong direction

    <script>
    
    
    function handleOnFocus(form_element)
    {
     var $span = $('.deleteicon span');
    $span.css({'right': '10px'});
    
    }
    function handleOnBlur()
    {
     var $span = $('.deleteicon span');
    $span.css({'right': '10px'});     
                
               
    }
    </script>
    

    it don't want to go to the right when i clck it just stand still and when i release aka blur it go to the far (i always tried to give opposite numbers but it do the same thing) :/

     

     

    btw i got a code of jquery that i donno why i doesn't want to work , maybe someone can help and tell why it doesn't since i am totally new with javascript here is the code:

    </style>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
    </script>
    <script>
                $(document).ready(function() {
                    $('input.inputfield').wrap('<span class="deleteicon" />').after($('<span/>').click(function() {
    
        $('.inputfield').val('').focus();
    }));
    
    $('.inputfield').keyup(function() {
        var $span = $('.deleteicon span');
        if($('.inputfield').value.length > 0 && !$span.is(':visible'))  {
            $span.stop().fadeIn();
     }
        else if($('.inputfield').value.length == 0)
    {
            $span.stop().fadeOut();
    }
    });
    });
      
    
    
            </script>
    

    the aim of the script above is to fadeout a the clear button when there is no string in the text input and it fadein when there is a string inside, i tried to do everything as well but with no success, seems this javascript has no luck with me and seems its too hard as well

     

    Thanks for the help,

    Maxwel

  4. here is the part of the code which i use to add a clear button for an input field *inside it) but the problem i want when the input field is focused the span clear button move to the right 10px and when its blured it get back to 0px to the right i tried the script with alert and it worked the problem is that the clear button dont move :S idk why

    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    
    
    <script>
                $(document).ready(function() {
                    $('input.deletable').wrap('<span id="clear" class="deleteicon" />').after($('<span/>').click(function() {
                        $(this).prev('input').val('').focus();
                    }));
                });
    
    
            </script>
    <style>
             span.deleteicon {
                    position: relative;
                }
                span.deleteicon span {
                    position: absolute;
                    display: block;
                    top: 2px;
    right: 0px;
                    width: 16px;
                    height: 16px;
                    background: url('http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=4') 0 -690px;
                    cursor: pointer;
                }
                span.deleteicon input {
                    padding-right: 16px;
                }
            </style>
    <script>
    var textFieldInFocus;
    function handleOnFocus(form_element)
    {
     var element = document.getElementById('clear');
    element.style.right = "10px";
    }
    function handleOnBlur()
    {
          var element = document.getElementById('clear');
    
    element.style.right = "0px";
    }
    </script>

    html:

    <input size="150" class="deletable" onfocus="handleOnFocus(this)" onblur="handleOnBlur()" type="text" />

    any idea how to do it?

     

    Thanks alot,

    Lion

  5. Thanks for the regular help :) by the way i got 3 questions if u dont mind answer me them :) oh by the way i found that the player works 100% great with safari as well, you can try it as well :).

     

    First is what language is this script? and how to install/ use it with php?

    http://rg42.org/wiki/sndfile-waveform

     

    What about this? isnt that c++? how to compile/install/use it with php?

    https://github.com/cappelnord/waveformgen

     

    Last is this, how to use this player, where it's source?

     http://jplayer.org/

     

    Sorry for asking much but i am not that good with js as stated before and wanted to know about other 2 waveform generators cuz they seems give better results than one i use at the moment.

     

    Thanks very very much for all your help,

    Maxwel

  6. this is the whole js code which do everything in the html5 audio player. i don\t get what u mean by timeupdate event

     

    i am 0 at javascript but insisting to know more and to do that player while learning :)

     

    and here is the player i use : http://mbrservices.no-ip.org/Player1.html

    var c = document.getElementById('canvas');
    
    
    c.onclick = jump;
    
    
    var x = c.getContext('2d');
    var a = document.getElementById('audio');
      
    
    
    var isPlaying = false;
    
    
    a.load();
    
    
    window.setInterval(draw, 100);
    
    
    /*
    x.fillStyle = "rgba(200,0,0,0.5)";
    x.fillRect(0,0,820,140);
    */
    
    
    function draw()
    {
    x.clearRect(0,0,820,140);
    
    
    // play head
    
    
    x.strokeStyle = "rgba(0,0,0,0.8)";
    x.beginPath();
    x.moveTo(pos(a.currentTime), 0);
    x.lineTo(pos(a.currentTime), 129);
    x.closePath();
    x.stroke(); 
    
    
    
    
    setTime();
    
    
    
    
    // buffer head
    
    
    x.fillStyle = "rgba(0,0,0,0.2)";
    x.fillRect(0,129,pos(a.seekable.end(0)),140);
    
    
    
    
    }
    
    
    function setTime()
    {
    var text = Math.floor(a.currentTime / 60);
    text = text + ":";
    var seconds = Math.floor(a.currentTime % 60);
    if(seconds < 10)
    {
    text = text + "0";
    }
    text = text + seconds;
    document.getElementById("time").innerHTML = text;
    }
    
    
    function jump(e)
    {
    
    
         var x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
         
         x = x - 20;
         
         var pos = (x/820) * a.duration;
         
         if(pos < a.seekable.end(0))
         {
          a.currentTime = pos;
         }
    }
    
    
    function pos(time)
    {
    return Math.round((time / a.duration) * c.width);
    
    
    }
    
    
    
    
    
    
    
    
    var duration;
    
    
    window.onload = function getDuration() {
    audio = document.getElementById("audio");
    audio.addEventListener("loadedmetadata", function(_event) {
    duration = audio.duration;
    
    
    
    
    
    
    
    
    
    
    var text1 = Math.floor(duration  / 60);
    text1 = text1 + ":";
    var seconds1 = Math.floor(duration % 60);
    if(seconds1 < 10)
    {
    text1 = text1 + "0";
    }
    
    
    text1 = text1 + seconds1;
    document.getElementById("totaltime").innerHTML = text1;
    
    
    
    
    
    
    });
    
    
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    function audioPlayPause()
    {
    if(isPlaying)
    {
    isPlaying = false;
    a.pause();
    document.getElementById('pp').innerHTML = "Play";
    }
    else
    {
    isPlaying = true;
    a.play();
    document.getElementById('pp').innerHTML = "Pause";
    }
    }
    
    
    
    
    function audioStop()
    {
    if(isPlaying)
    {
    audioPlayPause();
    }
    
    
    a.currentTime = 0;
    }

    i think its gonna be tough task but i want to do it :

  7. you are the best really and you always help :) thanks alot actually do u mind being my supporter/helper until i am done with this project? i wish u dont mind

     

    here is a script of a html5 audio that go canvas but the problem is that it work correctly when i let it play alone but when i jump with the head (line that indicate current point) it messes up the time and the line reach the end of the canvas before the song itself ends.

     

    here is the code

    var c = document.getElementById('canvas');
    
    c.onclick = jump;
    
    var x = c.getContext('2d');
    var a = document.getElementById('audio');
      
     
    var isPlaying = false;
    
    a.load();
    
    window.setInterval(draw, 100);
    
    /*
    x.fillStyle = "rgba(200,0,0,0.5)";
    x.fillRect(0,0,820,140);
    */
    
    function draw()
    {
    	x.clearRect(0,0,820,140);
    	
    	// play head
    	
    	x.strokeStyle = "rgba(0,0,0,0.8)";
    	x.beginPath();
    	x.moveTo(pos(a.currentTime), 0);
    	x.lineTo(pos(a.currentTime), 129);
    	x.closePath();
    	x.stroke();	
    	
    	
    	setTime();
    
    	
    	// buffer head
    	
    	x.fillStyle = "rgba(0,0,0,0.2)";
    	x.fillRect(0,129,pos(a.seekable.end(0)),140);
    		
    
    }
    
    function setTime()
    {
    	var text = Math.floor(a.currentTime / 60);
    	text = text + ":";
    	var seconds = Math.floor(a.currentTime % 60);
    	if(seconds < 10)
    	{
    		text = text + "0";
    	}
    	text = text + seconds;
    	document.getElementById("time").innerHTML = text;
    }
    
    function jump(e)
    {
    
         var x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
         
         x = x - 20;
         
         var pos = (x/820) * a.duration;
         
         if(pos < a.seekable.end(0))
         {
         	a.currentTime = pos;
         }
    }
    
    function pos(time)
    {
    	return Math.round((time / a.duration) * c.width);
    }
    
    
    
    
    var duration;
     
    window.onload = function getDuration() {
    	audio = document.getElementById("audio");
    	audio.addEventListener("loadedmetadata", function(_event) {
    		duration = audio.duration;
    	
    
    
    
    
    		var text1 = Math.floor(duration  / 60);
    	text1 = text1 + ":";
    	var seconds1 = Math.floor(duration % 60);
    	if(seconds1 < 10)
    	{
    		text1 = text1 + "0";
    	}
    
    	text1 = text1 + seconds1;
    	document.getElementById("totaltime").innerHTML = text1;
    	
    
    
    		});
    
    }
    

    also i got another problem which is totaltime (duration) of the song, it sometimes load correctly and another it gives 0:00 (especially if the song is loaded for the first time but still it does that also if song did loaded before) any idea?

     

    i guess i found my starting point of this project just need help/support to make it and at same time to learn more about html5 and js :)

     

    Thanks,

    Maxwel

  8. trying to find some good Html5 Audio player with waveform that can be good as this example

     

    http://virtualdjradio.com/djsets/djset.php?mixid=11578-1

     

     

    does the example above use specific source code that known? or an api?

     

    i need even a begging code to begin with zz. i am so bad at javascript and still new in html5 but any support should help in supporting me and learn at the same time.

     

    Thanks in advance

     

    Maxwel

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.